256
edits
Line 118: | Line 118: | ||
precision(5.26, 1); // Returns "5.3" | precision(5.26, 1); // Returns "5.3" | ||
precision(5.24, 1); // Returns "5.2" | precision(5.24, 1); // Returns "5.2" | ||
==== precision ==== | |||
''string'' '''truncate'''(''string'' value, ''number'' length[, ''string'' appendage]); | |||
Returns the string truncated to specified length. If third argument is specified it will be appended to the returned string if it's truncated. | |||
'''Example''' | |||
truncate("Foobar", 3); // Returns "Foo" | |||
truncate("Foobar", 4, ".."); // Returns "Fo.." | |||
truncate("Foob", 4, ".."); // Returns "Foob" |
edits