From d93ed2a26dab220632d523caea0358d33dda7051 Mon Sep 17 00:00:00 2001 From: Emistry Date: Tue, 14 Jul 2015 22:11:26 +0800 Subject: Added F_InserComma Merge from rAthena. Returns a number with commas between every three digits. --- npc/other/Global_Functions.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'npc') diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 4e9060419..0475ff0a8 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -42,6 +42,19 @@ //============================================================ +////////////////////////////////////////////////////////////////////////////////// +// Returns a number with commas between every three digits. +// -- callfunc "F_InsertComma", +// Examples: +// callfunc("F_InsertComma",7777777) // returns "7,777,777" +////////////////////////////////////////////////////////////////////////////////// +function script F_InsertComma { + set .@str$, getarg(0); + for (set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3) + set .@str$, insertchar(.@str$,",",.@i); + return .@str$; +} + ////////////////////////////////////////////////////////////////////////////////// // Function that clears job quest variables ////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-60-g2f50