Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Releases Libraries [Library] Humanize - A human-friendly Pawn library

 
  • 0 Vote(s) - 0 Average
Library Humanize - A human-friendly Pawn library
Codeah
Offline

Moderator

Posts: 59
Threads: 7
Joined: Apr 2019
Reputation: 4
Location: Belarus
#1
2019-04-11, 04:08 PM (This post was last modified: 2019-04-15, 09:24 AM by kristo.)
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.
Markski
Offline

Burgershot Clerk

Posts: 127
Threads: 6
Joined: Apr 2019
Reputation: 5
Location: La Plata, Argentina
#2
2019-04-11, 09:55 PM
This is really nice, thanks for sharing
Website
BigETI
Offline

open.mp Developer

Posts: 107
Threads: 5
Joined: Feb 2019
Reputation: 12
Location: Germany
#3
2019-04-12, 06:42 AM
noice
[Image: github-samp-icon.png]
JustMichael
Offline

Forum Manager

Posts: 189
Threads: 3
Joined: Feb 2019
Reputation: 17
Location: England
#4
2019-04-12, 07:52 AM
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
Remember to always refer to J0sh as `J0sh...`

@ Networks/Servers
San Andreas Gaming Network (Owner/Founder)
San Andreas Gaming (Owner/Founder)
Grand Theft Cop's n Robber's (Owner)
Britannia Roleplay (Owner/Founder)
Alpine RP (Owner/Founder)
Aluminium Network (Maintainer)
AlphaDM (Tech Support)

# Services
Burgershot.gg (Forum Manager)
open.mp (Member)

~ Languages/Frameworks
Pawn, C, C++, C#, Javascript, Typescript, Lua, Python, Go, Rust, PHP, SQL,
Angular, React, Vue, Svelte, Laravel, Rocket
cuddlypanda
Offline

Shiller Department Director
Posts: 63
Threads: 6
Joined: Feb 2019
Reputation: 3
Location: forest
#5
2019-04-12, 12:48 PM
Very nice, good lad!
[Image: about.jpg]
SyS
Offline

Burgershot Member
Posts: 37
Threads: 5
Joined: Apr 2019
Reputation: 4
#6
2019-04-12, 01:30 PM
Nice!
klays
Offline

i like dogs
Posts: 53
Threads: 2
Joined: Apr 2019
Reputation: 1
Location: chile
#7
2019-04-13, 10:46 PM
nice!!
Faith Hills Role-Play
Faith Hills, juego de rol
WEBSITE: fhrp.me
TheOmnitrix
Offline

Burgershot Member
Posts: 1
Threads: 0
Joined: Apr 2019
Reputation: 0
#8
2019-04-13, 10:53 PM
Interesting
klays
Offline

i like dogs
Posts: 53
Threads: 2
Joined: Apr 2019
Reputation: 1
Location: chile
#9
2019-04-13, 10:58 PM (This post was last modified: 2019-04-13, 10:58 PM by klays.)
the use of this is:
Code:
HumanizeNumber(100, "cien");

right?
Faith Hills Role-Play
Faith Hills, juego de rol
WEBSITE: fhrp.me
Codeah
Offline

Moderator

Posts: 59
Threads: 7
Joined: Apr 2019
Reputation: 4
Location: Belarus
#10
2019-04-14, 06:26 AM
(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
xarland
Offline

Burgershot Member
Posts: 1
Threads: 0
Joined: Apr 2019
Reputation: 0
Location: Russia
#11
2019-04-14, 10:35 AM (This post was last modified: 2019-04-14, 10:36 AM by xarland.)
How about multilingual support?
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode