toUppercase() makes an entirely uppercase copy of the string.
toLowercase() makes an entirely lowercase copy of the string.
substring() returns a specific part of the string.
indexOf() determines whether one string occurs within another.
The string object has many other methods, but these are highlighted because they're useful for beginners. Many string methods, such as big()and fontcolor(), simply add HTML code to text. They aren't used very often because they produce HTML code that won't validate, and they don't really save effort. Some other methods, such as search(), replace(), and slice(), use advanced constructs like arrays and regular expressions that aren't necessary for beginners.
Like properties, methods are attached to an object by the period. Methods are distinguished by a pair of parentheses, which sometimes contain special information called parameters.
The best way to see how methods work is to look at some in action. Look at the code for stringMethods.html:
In this example, the text was explicitly defined as a string variable by saying
var text = new String;
Here's another cool thing about Komodo Edit. When you type text, Komodo understands that you're talking about a string variable and automatically pops up a list of all the possible properties and methods of the string object.
You can see from the preceding code that methods are pretty easy to use. When you have a string variable, you can invoke the variable name followed by a period and the method name. Some methods require more information to do their job. Here are the specifics:
toUppercase() and toLowercase() take the value of the variable and convert it entirely to the given case. This method is often used when you aren't concerned about the capitalization of a variable.
indexOf(substring) returns the character position of the substring within the variable. If the variable doesn't contain the substring, it returns the value -1.
substring(begin,end) returns the substring of the variable from the beginning character value to the end.