Mel: String

From wikinotes

New Line

print "\n";					//Begins a New Line

print "a \n b";					//Prints "a" then a new line starting with "b"

print "a", "b";					//Prints "a" then a new line starting with "b"

Adding to a string

string $test = "String";
print ($test +"Cheese");			//Prints "String Cheese"

Testing if a string holds a value

if ($string == "") { //then execute }}		//Test for an Empty string

Tokenize

Tokenize will divide a string by a single character and store it's chunks in an array. Tokenize with multiple characters will search for any individual instance of a character. ex: tokenize $mystring "ab" $buffer; would remove any "a"s or "b"s and not search for "ab"s.

string $mystring = "myObject.translateX.89";
string $buffer[];

tokenize $mystring "." $buffer;


//Result://

buffer[0] == "myyObject";
buffer[1] == "translateX";
buffer[2] == "89";

substituteAllString

substituteAllString replaces every instance of a string with another string. You can use multiple characters.

string $origString = "C:/Users/Will/Desktop"

substituteAllString ($origString, "/", "_")

//Result:// C:_Users_Will_Desktop