| Size: 12642 Comment:  | Size: 12814 Comment:  | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 3: | Line 3: | 
| These should be written in the following formats: .''variable.function(arguments)'', example - ''myVar.subStr(3,2)'' if your variable name was "myVar" and you wanted to use subStr() to find the 2 characters that begin 3 from the left. .''object.function(arguments)'', example - ''city.coords.split(",")'' if you wanted to split the coordinates of your city into an array to determine the seperate x and y values using the split() function. | These should be written in the following formats: . ''variable.function(arguments)'', example - ''myVar.subStr(3,2)'' if your variable name was "myVar" and you wanted to use subStr() to find the 2 characters that begin 3 from the left. . ''object.function(arguments)'', example - ''city.coords.split(",")'' if you wanted to split the coordinates of your city into an array to determine the seperate x and y values using the split() function. | 
| Line 11: | Line 12: | 
| ||<tablewidth="796px" tableheight="123px"#cccccc>'''Function ''' ||<#cccccc>'''Type''' ||<#cccccc>'''Description '''||||<style="text-align:center"> || || | ||<tablewidth="796px" tableheight="123px"#cccccc>'''Function ''' ||<#cccccc>'''Type''' ||<#cccccc>'''Description ''' ||||<style="text-align:center"> || || | 
| Line 32: | Line 33: | 
| ||[[#ToCSV|ToCSV]] ||String ||Converts arguments to comma-separated string with values enclosedi in qouble quotes. || | ||[[#ToCSV|ToCSV]] ||String ||Converts arguments to comma-separated string with values enclosed in qouble quotes. || | 
| Line 45: | Line 46: | 
| Line 51: | Line 54: | 
| .echo !CenterPad("This is a test", 25, ".") '''Result:''' ......This is a test...... | . echo !CenterPad("This is a test", 25, ".") '''Result:''' . .....This is a test...... | 
| Line 62: | Line 67: | 
| .// Don't forget almost all internal "counting" starts at 0, not at 1... .// so the 5th character would actually be 0, 1, 2, 3, '''4''' <--- 4! .var="hello" .echo "The 5th letter in the word hello is: " + var.charAt(4) '''Result:''' .The 5th letter in the word hello is: o | . // Don't forget almost all internal "counting" starts at 0, not at 1... . // so the 5th character would actually be 0, 1, 2, 3, '''4''' <--- 4! . var="hello" . echo "The 5th letter in the word hello is: " + var.charAt(4) '''Result:''' . The 5th letter in the word hello is: o | 
| Line 76: | Line 83: | 
| .var="hello" .echo "The numeric code of the 5th letter in the word hello is: " + var.charCodeAt(4) '''Result:''' .The numeric code of the 5th letter in the word hello is: 111 | . var="hello" . echo "The numeric code of the 5th letter in the word hello is: " + var.charCodeAt(4) '''Result:''' . The numeric code of the 5th letter in the word hello is: 111 | 
| Line 88: | Line 97: | 
| .var="oompa" .var2="loompa" .var3="dance" .echo var.concat(var2," ",var3) '''Result:''' .oompaloompa dance | . var="oompa" . var2="loompa" . var3="dance" . echo var.concat(var2," ",var3) '''Result:''' . oompaloompa dance | 
| Line 97: | Line 108: | 
| '''Usage:''' | '''Usage:''' | 
| Line 102: | Line 113: | 
| . '''Result:''' | . '''Result:''' | 
| Line 108: | Line 121: | 
| '''Usage:''' | '''Usage:''' | 
| Line 113: | Line 126: | 
| . '''Result:''' | . '''Result:''' | 
| Line 119: | Line 134: | 
| '''Usage:''' | '''Usage:''' | 
| Line 124: | Line 139: | 
| . '''Result:''' | . '''Result:''' | 
| Line 135: | Line 152: | 
| .echo !LeftPad("This is a test", 25, ".") '''Result:''' ............This is a test | . echo !LeftPad("This is a test", 25, ".") '''Result:''' . ...........This is a test | 
| Line 141: | Line 160: | 
| '''Usage:''' | '''Usage:''' | 
| Line 146: | Line 165: | 
| . '''Result:''' | . '''Result:''' | 
| Line 152: | Line 173: | 
| '''Usage:''' | '''Usage:''' | 
| Line 157: | Line 178: | 
| . '''Result:''' | . '''Result:''' | 
| Line 168: | Line 191: | 
| .echo Merge("This is a test", "of the Emergency Broadcast System") .echo Merge("One plus One", "Two", " = ") '''Result:''' .This is a test of the Emergency Broadcast System .One plus One = Two | . echo Merge("This is a test", "of the Emergency Broadcast System") . echo Merge("One plus One", "Two", " = ") '''Result:''' . This is a test of the Emergency Broadcast System . One plus One = Two | 
| Line 181: | Line 206: | 
| .echo !RightPad("This is a test", 25, ".") '''Result:''' .This is a test........... | . echo !RightPad("This is a test", 25, ".") '''Result:''' . This is a test........... | 
| Line 187: | Line 214: | 
| '''Usage:''' | '''Usage:''' | 
| Line 192: | Line 219: | 
| . '''Result:''' | . '''Result:''' | 
| Line 198: | Line 227: | 
| '''Usage:''' | '''Usage:''' | 
| Line 203: | Line 232: | 
| . '''Result:''' | . '''Result:''' | 
| Line 209: | Line 240: | 
| '''Usage:''' | '''Usage:''' | 
| Line 214: | Line 245: | 
| . '''Result:''' | . '''Result:''' | 
| Line 225: | Line 258: | 
| .mycoords=city.coords.split(",") .echo "x:" + mycoords[0] + " y:" + mycoords[1] '''Result:''' .x:746 y:34 | . mycoords=city.coords.split(",") . echo "x:" + mycoords[0] + " y:" + mycoords[1] '''Result:''' . x:746 y:34 | 
| Line 237: | Line 272: | 
| .echo !StringRepeat(25, ".") .echo !StringRepeat(25, "Test") .echo !StringRepeat(25, "Test ") '''Result:''' .......................... .!TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest .!Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test | . echo !StringRepeat(25, ".") . echo !StringRepeat(25, "Test") . echo !StringRepeat(25, "Test ") '''Result:''' . ......................... . !TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest . Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test | 
| Line 252: | Line 289: | 
| .str = "test1:no1,test2:no2" .o = !StringToObject(str,",",":") .echo o.test2 '''Result:''' .no2 | . str = "test1:no1,test2:no2" . o = !StringToObject(str,",",":") . echo o.test2 '''Result:''' . no2 | 
| Line 260: | Line 299: | 
| '''Usage:''' | '''Usage:''' | 
| Line 265: | Line 304: | 
| . '''Result:''' | . '''Result:''' | 
| Line 271: | Line 312: | 
| '''Usage:''' | '''Usage:''' | 
| Line 276: | Line 317: | 
| . '''Result:''' | . '''Result:''' | 
| Line 287: | Line 330: | 
| .who = "Bob" .what = "Cap his city" .when = date() .echo ToCSV(who, what, when) '''Result:''' ."Bob","Cap his city","Tue Feb 11 19:59:38 GMT-0500 2014" | . who = "Bob" . what = "Cap his city" . when = date() . echo ToCSV(who, what, when) '''Result:''' . "Bob","Cap his city","Tue Feb 11 19:59:38 GMT-0500 2014" | 
| Line 296: | Line 341: | 
| '''Usage:''' | '''Usage:''' | 
| Line 301: | Line 346: | 
| . '''Result:''' | . '''Result:''' | 
| Line 307: | Line 354: | 
| '''Usage:''' | '''Usage:''' | 
| Line 312: | Line 359: | 
| . '''Result:''' | . '''Result:''' | 
| Line 318: | Line 367: | 
| '''Usage:''' | '''Usage:''' | 
| Line 323: | Line 372: | 
| . '''Result:''' | . '''Result:''' | 
| Line 329: | Line 380: | 
| '''Usage:''' | '''Usage:''' | 
| Line 334: | Line 385: | 
| . '''Result:''' | . '''Result:''' | 
| Line 345: | Line 398: | 
| .echo Upper1("testing") '''Result:''' .Testing | . echo Upper1("testing") '''Result:''' . Testing | 
| Line 351: | Line 406: | 
| '''Usage:''' | '''Usage:''' | 
| Line 356: | Line 411: | 
| . '''Result:''' | . '''Result:''' | 
| Line 367: | Line 424: | 
| .echo !FormatMiles(123) .echo !FormatMiles(123.4) '''Result:''' .123.00 miles .123.40 miles | . echo !FormatMiles(123) . echo !FormatMiles(123.4) '''Result:''' . 123.00 miles . 123.40 miles | 
| Line 380: | Line 439: | 
| .echo !FormatNumber("1234567") .echo !FormatNumber("1234567","2") '''Result:''' .1,234,567 .1,234,567.00 | . echo !FormatNumber("1234567") . echo !FormatNumber("1234567","2") '''Result:''' . 1,234,567 . 1,234,567.00 | 
| Line 393: | Line 454: | 
| .echo !FormatNumber2("1234567") '''Result:''' .1,234,567.00 | . echo !FormatNumber2("1234567") '''Result:''' . 1,234,567.00 | 
| Line 404: | Line 467: | 
| .echo !FormatPercent("1") .echo !FormatPercent("0.25","0") .echo !FormatPercent("0.25","2") '''Result:''' .100.0% .25% .25.00% | . echo !FormatPercent("1") . echo !FormatPercent("0.25","0") . echo !FormatPercent("0.25","2") '''Result:''' . 100.0% . 25% . 25.00% | 
The following functions can be used to manipulate and retrieve string details from objects and variables.
These should be written in the following formats:
- variable.function(arguments), example - myVar.subStr(3,2) if your variable name was "myVar" and you wanted to use subStr() to find the 2 characters that begin 3 from the left. 
- object.function(arguments), example - city.coords.split(",") if you wanted to split the coordinates of your city into an array to determine the seperate x and y values using the split() function. 
Click each function name in the table below for more details of it, with examples.
Functions
| Function | Type | Description | 
 | 
 | |
| String | Prepends and appends spaces (or specified character) to a string to form string of the desired length. | ||||
| String | Returns the character in the position specified by the index parameter. | ||||
| Number | Returns the numeric Unicode character code of the character at the specified index. | ||||
| String | Appends the supplied arguments to the end of the String object, converting them to strings if necessary, and returns the resulting string. | ||||
| String | Returns a string comprising the characters represented by the Unicode character codes in the parameters. | ||||
| int | Searches the string and returns the position of the first occurrence of val found at or after startIndex within the calling string. | ||||
| int | Searches the string from right to left and returns the index of the last occurrence of val found before startIndex. | ||||
| String | Prepends spaces (or specified character) to a string to form string of the desired length. | ||||
| int | Compares the sort order of two or more strings and returns the result of the comparison as an integer. | ||||
| Array | Matches the specifed pattern against the string. | ||||
| String | Concatenate str1 and str2 together, delim is inserted between strings if both strings are not empty | ||||
| String | Matches the specifed pattern against the string and returns a new string in which the first match of pattern is replaced with the content specified by repl. | ||||
| String | Appends spaces (or specified character) to a string to form string of the desired length. | ||||
| int | Searches for the specifed pattern and returns the index of the first matching substring. | ||||
| String | Returns a string that includes the startIndex character and all characters up to, but not including, the endIndex character. | ||||
| Array | Splits a String object into an array of substrings by dividing it wherever the specified delimiter parameter occurs. | ||||
| String | Makes a string consisting of spaces (or of specified string) repeated count times. | ||||
| String | Parses and converts strings with parameters into object. | ||||
| String | Returns a substring consisting of the characters that start at the specified startIndex and with a length specified by len. | ||||
| String | Returns a string consisting of the character specified by startIndex and all characters up to endIndex - 1. | ||||
| String | Converts arguments to comma-separated string with values enclosed in qouble quotes. | ||||
| String | Returns a copy of this string, with all uppercase characters converted to lowercase. | ||||
| String | Returns a copy of this string, with all lowercase characters converted to uppercase. | ||||
| String | Returns a copy of this string, with all uppercase characters converted to lowercase. | ||||
| String | Returns a copy of this string, with all lowercase characters converted to uppercase. | ||||
| String | Upper cases the first letter of a string. | ||||
| String | Returns the primitive value of a String instance. | ||||
| int | Converts number to a string, e.g. "2.34 miles". | ||||
| int | Formats number with specified precision, e.g. "2,346". | ||||
| int | Formats numbers with 2 decimal places, e.g. "2,345.56". | ||||
| int | Formats number as percentage, e.g. "9.1%". | ||||
CenterPad
Usage: CenterPad(str, targetLength, optional padChar = " ")
Prepends and appends spaces (or specified character) to a string to form string of the desired length.
Example:
- echo CenterPad("This is a test", 25, ".") 
Result:
- .....This is a test......
charAt
Usage: charAt(#)
Returns the character in the position specified by the index parameter.
Example:
- // Don't forget almost all internal "counting" starts at 0, not at 1...
- // so the 5th character would actually be 0, 1, 2, 3, 4 <--- 4! 
- var="hello"
- echo "The 5th letter in the word hello is: " + var.charAt(4)
Result:
- The 5th letter in the word hello is: o
charCodeAt
Usage: charCodeAt(#)
Returns the numeric Unicode character code of the character at the specified index.
Example:
- var="hello"
- echo "The numeric code of the 5th letter in the word hello is: " + var.charCodeAt(4)
Result:
- The numeric code of the 5th letter in the word hello is: 111
concat
Usage: concat(arg1,arg2,...,argN)
Appends the supplied arguments to the end of the String object, converting them to strings if necessary, and returns the resulting string.
Example:
- var="oompa"
- var2="loompa"
- var3="dance"
- echo var.concat(var2," ",var3)
Result:
- oompaloompa dance
fromCharCode
Usage:
Returns a string comprising the characters represented by the Unicode character codes in the parameters.
Example:
Result:
indexOf
Usage:
Searches the string and returns the position of the first occurrence of val found at or after startIndex within the calling string.
Example:
Result:
lastIndexOf
Usage:
Searches the string from right to left and returns the index of the last occurrence of val found before startIndex.
Example:
Result:
LeftPad
Usage: LeftPad(str, targetLength, optional padChar = " ")
Prepends spaces (or specified character) to a string to form string of the desired length.
Example:
- echo LeftPad("This is a test", 25, ".") 
Result:
- ...........This is a test
localeCompare
Usage:
Compares the sort order of two or more strings and returns the result of the comparison as an integer.
Example:
Result:
match
Usage:
Matches the specifed pattern against the string.
Example:
Result:
Merge
Usage: Merge(str1, str2, optional delim = " ")
Concatenate str1 and str2 together, delim is inserted between strings if both strings are not empty.
Example:
- echo Merge("This is a test", "of the Emergency Broadcast System")
- echo Merge("One plus One", "Two", " = ")
Result:
- This is a test of the Emergency Broadcast System
- One plus One = Two
RightPad
Usage: RightPad(str, targetLength, optional padChar = " ")
Appends spaces (or specified character) to a string to form string of the desired length.
Example:
- echo RightPad("This is a test", 25, ".") 
Result:
- This is a test...........
replace
Usage:
Matches the specifed pattern against the string and returns a new string in which the first match of pattern is replaced with the content specified by repl.
Example:
Result:
search
Usage:
Searches for the specifed pattern and returns the index of the first matching substring.
Example:
Result:
slice
Usage:
Returns a string that includes the startIndex character and all characters up to, but not including, the endIndex character.
Example:
Result:
split
Usage: split("delimiter")
Splits a String object into an array of substrings by dividing it wherever the specified delimiter parameter occurs.
Example:
- mycoords=city.coords.split(",")
- echo "x:" + mycoords[0] + " y:" + mycoords[1]
Result:
- x:746 y:34
StringRepeat
Usage: StringRepeat(count, optional str = " ")
Makes a string consisting of spaces (or of specified string) repeated count times.
Example:
- echo StringRepeat(25, ".") 
- echo StringRepeat(25, "Test") 
- echo StringRepeat(25, "Test ") 
Result:
- .........................
- TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest 
- Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test
StringToObject
Usage: StringToObject(str, delim1, delim2, optional result = null)
Parses and converts strings with parameters into object.
Example:
- str = "test1:no1,test2:no2"
- o = StringToObject(str,",",":") 
- echo o.test2
Result:
- no2
substr
Usage:
Returns a substring consisting of the characters that start at the specified startIndex and with a length specified by len.
Example:
Result:
substring
Usage:
Returns a string consisting of the character specified by startIndex and all characters up to endIndex - 1.
Example:
Result:
ToCSV
Usage: ToCSV(...args)
Converts arguments to comma-separated string with values enclosedi in qouble quotes.
Example:
- who = "Bob"
- what = "Cap his city"
- when = date()
- echo ToCSV(who, what, when)
Result:
- "Bob","Cap his city","Tue Feb 11 19:59:38 GMT-0500 2014"
toLocaleLowerCase
Usage:
Returns a copy of this string, with all uppercase characters converted to lowercase.
Example:
Result:
toLocaleUpperCase
Usage:
Returns a copy of this string, with all lowercase characters converted to uppercase.
Example:
Result:
toLowerCase
Usage:
Returns a copy of this string, with all uppercase characters converted to lowercase.
Example:
Result:
toUpperCase
Usage:
Returns a copy of this string, with all lowercase characters converted to uppercase.
Example:
Result:
Upper1
Usage: Upper1(str)
Upper cases the first letter of a string.
Example:
- echo Upper1("testing")
Result:
- Testing
valueOf
Usage:
Returns the primitive value of a String instance.
Example:
Result:
FormatMiles
Usage: FormatMiles(number)
Converts number to a string like "2.34 miles".
Example:
- echo FormatMiles(123) 
- echo FormatMiles(123.4) 
Result:
- 123.00 miles
- 123.40 miles
FormatNumber
Usage: FormatNumber(number, optional precision = 0, optional useThousandsSeparator = true)
Formats number with specified precision. Default has no decimal places, e.g. "2,346"
Example:
- echo FormatNumber("1234567") 
- echo FormatNumber("1234567","2") 
Result:
- 1,234,567
- 1,234,567.00
FormatNumber2
Usage: FormatNumber2(number, optional precision = 0, optional useThousandsSeparator = true)
Formats number with 2 decimal places, e.g. "2,345.56".
Example:
- echo FormatNumber2("1234567") 
Result:
- 1,234,567.00
FormatPercent
Usage: FormatPercent(number, optional presision = 1)
Formats number as percentage.
Example:
- echo FormatPercent("1") 
- echo FormatPercent("0.25","0") 
- echo FormatPercent("0.25","2") 
Result:
- 100.0%
- 25%
- 25.00%



























![[+]](/moin_static/explorer/img/toggle1.png)

![[-]](/moin_static/explorer/img/toggle0.png)
