.What information is available about a String?
A String type has the following members:
| Integer AsInteger |
| Answer the string converted to an integer |
| Object Contains(Object obj) |
| Determine whether this string contains another string |
| Object Equals(Object obj) |
| Determine whether this object is equal to another object |
| Object EqualsCaseInsensitive(Object obj) |
| Determine whether this string is equal to another string (ignoring case) |
| Integer IndexOf(Object obj) |
| Answer an integer giving the first index of the provided string, or -1 if the string does not contain the provided string. |
| Integer Length |
| Answer the number of characters in this string |
| String Repeat(Integer count) |
| Answer a new string than is the concatenation of the given number of copies of this string |
| String Reverse |
| Answer a copy of this string with the characters reversed |
| String Substring(Integer index, Integer length {optional}) |
| Answer a substring of this string starting at the given character and possibly limited to the given number of characters |
Integers represent, well, integers :-)
7/20/2007 10:21:17 PM - -10.10.192.236
Object is the root type in the WikiTalk language; almost all types inherit from Object
9/14/2007 2:00:49 PM - -74.15.242.151
Object is the root type in the WikiTalk language; almost all types inherit from Object
9/14/2007 2:00:49 PM - -74.15.242.151
Object is the root type in the WikiTalk language; almost all types inherit from Object
9/14/2007 2:00:49 PM - -74.15.242.151
Integers represent, well, integers :-)
7/20/2007 10:21:17 PM - -10.10.192.236
Integers represent, well, integers :-)
7/20/2007 10:21:17 PM - -10.10.192.236
Strings represent a sequence of characters
9/13/2007 3:28:28 PM - -74.15.247.173
Strings represent a sequence of characters
9/13/2007 3:28:28 PM - -74.15.247.173
Strings represent a sequence of characters
9/13/2007 3:28:28 PM - -74.15.247.173
Questions
Examples
Compare two strings
"hello".Equals("hello")
true
"Hello".EqualsCaseInsensitive("HELLO")
true
Check to see if a string contains another string
"Hello Dolly".Contains("Dolly")
true
"Hello Dolly".Contains("Panda")
false
Repeat
"x".Repeat(5)
xxxxx
Length
"".Length
0
"!!!".Repeat(1000).Length
3000
Reverse
"Reverse".Reverse
esreveR
Substring
"FlexWiki".Substring(0,4)
Flex
"FlexWiki".Substring(2,4)
exWi
"FlexWiki".Substring(4)
Wiki
Empty
empty.Length
0
How to concatenate / append strings
Concatenate strings by creating an array of strings and converting the array to a string.
["String 1", "String 2"].ToOneString
String 1String 2
The Newline constant
Newline = '
'
Newline.Length = '2'
Newline.Substring(1,1) = '
'
Newline.Substring(0,1) = '
'
Max Length String
String.MaxLengthString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 12)
ABCDEFGHIJKL
String.MaxLengthString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 12, "xxx")
ABCDEFGHIxxx