StendhalScripting/LuaAPI: Difference between revisions
Content deleted Content added
imported>AntumDeluge →arrays: clean up |
imported>AntumDeluge →String Manipulation: new methods "string.isNumber" & "string.builder" |
||
Line 262:
The following methods have been added to the built-in Lua [https://www.lua.org/manual/5.3/manual.html#6.4 string] library.
:; ''aliases:''
* ''<span style="color:green;">string.beginsWith</span>(st, prefix)''▼
:: <span style="color:green; font-style:italic;">string.beginsWith</span>
* ''<span style="color:green;">string.endsWith</span>(st, suffix)''▼
** Checks if a string ends with a set of characters.▼
** <span style="color:darkgreen; text-style=italic;">st:</span> The string to be checked.▼
** <span style="color:darkgreen; text-style=italic;">suffix:</span> The suffix to be compared with.▼
** returns: <code>true</code> if <code>suffix</code> matches then end characters of <code>st</code>.▼
* ''<span style="color:green;">string.trim</span>(st)''▼
** Removes leading & trailing whitespace from a string.▼
▲** <span style="color:darkgreen; text-style=italic;">st:</span> The string to be trimmed.
** returns: Trimmed string.▼
* ''<span style="color:green;">string.ltrim</span>(st)''▼
** Removes leading whitespace from a string.▼
** returns: Trimmed string.▼
* ''<span style="color:green;">string.rtrim</span>(st)''▼
** Removes trailing whitespace from a string.▼
** returns: Trimmed string.▼
: '''''st:''''' The string to be checked.
▲
▲
: Checks if a string contains numeric characters only.
: '''''st:''''' The string to be checked.
: ''returns:'' <code>true</code> if all characters are numeric, <code>false</code> otherwise.
:; ''aliases:''
▲
: '''''st:''''' The string to be trimmed.
: '''''st:''''' The string to be trimmed.
: '''''st:''''' The string to be trimmed.
; ''<span style="color:green;">string.builder</span>(st)''
: Creates a new instance of [https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html java.lang.StringBuilder].
: '''''st:''''' (optional) String to append on instantiation.
: ''returns:'' new StringBuilder instance.
== Table Manipulation ==
| |||