String - MSUTeam/MSU GitHub Wiki
File path: scripts/config/msu/string.nut
::MSU.String.capitalizeFirst( _string )
// _string is a string
Returns _string
with the first character capitalized.
::MSU.String.replace( _string, _find, _replace, _all = false )
// _string, _find and _replace are strings
// _all is a boolean
Returns _string
with the first instance of _find
replaced with _replace
.
If _all
is true, replaces every instance of _find
with _replace
.
::MSU.String.isInteger( _string )
// _string is a string
Returns true
if _string
can be losslessly cast to an integer.
This handles leading 0s and other edge cases correctly,
unlike something like string == string.tointeger().tostring()
.
Returns false
otherwise.
::MSU.String.startsWith( _string, _start )
// _string and _start are strings
Returns true
if string
starts with _start
, otherwise returns false
.
::MSU.String.endsWith( _string, _end )
// _string and _start are strings
Returns true
if string
ends with _end
, otherwise returns false
.