open.mp forum
[Library] Humanize - A human-friendly Pawn library - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31)
---- Thread: [Library] Humanize - A human-friendly Pawn library (/showthread.php?tid=26)



Humanize - A human-friendly Pawn library - Codeah - 2019-04-11

Humanize

Description



Humanize is a library that makes stuff computers can read easily, more readable for humans.



Features



Thousands Seperators



Code:
0 -> 0

100 -> 100

1000 -> 1,000

1000000 -> 1,000,000

-100000 -> -100,000

Code:
HumanizeThousand(integer, dest[], maxLength = sizeof dest, delimiter[] = ",")



Colors

Code:
0xA86420FF -> "Chocolate Brown"

0x42F44EFF -> "Lime Green"

0x137A8EFF -> "Teal"

Code:
HumanizeColor(color, dest[], maxLength = sizeof dest)



Numbers to words

Code:
1000 -> "one thousand"

1234 -> "one thousand two hundred thirty-four"

-1234 -> "negative one thousand two hundred thirty-four"

Code:
HumanizeNumber(number, dest[], maxLength = sizeof dest)



Ordinals

Code:
0 -> 0th

1 -> 1st

2 -> 2nd

3 -> 3rd

4 -> 4th

etc...

Code:
HumanizeOrdinal(number, dest[], maxLength = sizeof dest)



Install / Download



You can find all releases here.



Alternatively, you can simply install Humanize to your project using SampCTL.

Code:
sampctl package install thecodeah/pawn-humanize

Include in your code and begin using the library:

Code:
#include <humanize>



Issues / Suggestions



Please leave suggestions and report issues on Github.


RE: Humanize - A human-friendly Pawn library - Markski - 2019-04-11

This is really nice, thanks for sharing


RE: Humanize - A human-friendly Pawn library - BigETI - 2019-04-12

noice


RE: Humanize - A human-friendly Pawn library - JustMichael - 2019-04-12

Wow, just the other day a gamemode I was working on had a non-functioning attempt at humanizing numbers.



Seeing this, just makes my day


RE: Humanize - A human-friendly Pawn library - cuddlypanda - 2019-04-12

Very nice, good lad!


RE: Humanize - A human-friendly Pawn library - SyS - 2019-04-12

Nice!


RE: Humanize - A human-friendly Pawn library - klays - 2019-04-13

nice!!


RE: Humanize - A human-friendly Pawn library - TheOmnitrix - 2019-04-13

Interesting


RE: Humanize - A human-friendly Pawn library - klays - 2019-04-13

the use of this is:
Code:
HumanizeNumber(100, "cien");

right?


RE: Humanize - A human-friendly Pawn library - Codeah - 2019-04-14

(2019-04-13, 10:58 PM)klays Wrote: the use of this is:

Code:
HumanizeNumber(100, "cien");



right?



You use it similarly to the way you provide the format function with a variable that it then writes to.





https://github.com/thecodeah/pawn-humanize/blob/master/test.pwn#L51


RE: Humanize - A human-friendly Pawn library - xarland - 2019-04-14

How about multilingual support?