Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_insert_separator_commas

(view raw script w/o annotations or w/e)
1
function insert_separator_commas(argument0) //gml_Script_insert_separator_commas
2
{
3
    var _neg = ""
4
    var _str = string(floor(abs(argument0)))
5
    var _frac = string(frac(abs(argument0)))
6
    var _c = 0
7
    if (argument0 < 0)
8
        _neg = "-"
9
    repeat floor((string_length(_str) - 1) / 3)
10
    {
11
        _str = string_insert(",", _str, (string_length(_str) - 3 * (_c + 1) - _c + 1))
12
        _c++
13
    }
14
    return (_neg + _str + (string_copy(_frac, 2, (string_length(_frac) - 1))));
15
}