Skip to content

thecodeah/pawn-humanize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pawn-humanize

Pawn-humanize is a library inspired by go-humanize that makes stuff computers can read easily, more readable for humans.

Installation (Sampctl)

Simply install to your project:

sampctl package install thecodeah/pawn-humanize

Include in your code and begin using the library:

#include <humanize>

Features

Thousands Seperators

0 -> 0
100 -> 100
1000 -> 1,000
1000000 -> 1,000,000
-100000 -> -100,000
HumanizeThousand(integer, dest[], maxLength = sizeof dest, delimiter[] = ",")

Colors

0xA86420FF -> "Chocolate Brown"
0x42F44EFF -> "Lime Green"
0x137A8EFF -> "Teal"
HumanizeColor(color, dest[], maxLength = sizeof dest)

Numbers to words

1000 -> "one thousand"
1234 -> "one thousand two hundred thirty-four"
-1234 -> "negative one thousand two hundred thirty-four"
HumanizeNumber(number, dest[], maxLength = sizeof dest)

Ordinals

0 -> 0th
1 -> 1st
2 -> 2nd
3 -> 3rd
4 -> 4th
etc...
HumanizeOrdinal(number, dest[], maxLength = sizeof dest)