Using functions/methods of this class you will need to create an object, a prefix.
Lets go to see an example: you have the string Abcdef and would like to isolate the first character. There are a method of the class that do it:
But you need first to create the object doing:
st = new String("Abcdef"); x = st.charAt(0);
The value of x will be: A (the first index value is zero).
Using the prefix st - remember that you need to do the operation above - the methods of the class are:
st.charAt(index) Returns the single character at position index. st.charCodeAt(index) Returns the UNICODE encoding of the character at position index. st.concat(string2) Returns a string conytaining string2 added to the end of the original string. st.indexOf(searchValue, fromIndex) Returns position of first occurence of the substring searchValue starting at index fromIndex. st.lastIndexOf(searchValue, fromIndex) Returns position of last occurence of the substring searchValue searching backwards from index fromIndex. this.st.slice(start, end) Returns the substring starting at start and ending at end. st.split(separator) Returns an array of strings created by separing the original string at every occurrence of separator. st.substr(start, length) Returns a substring starting at position start and having a length of characters. st.substring(index1,index2) Returns the substring from index1 to index2. st.toLowerCase() Returns the original string with all caracters converted. st.toUpperCase() Returns the original string with all caracters converted.
st.length An integer representing the number of characters in the original string An example of the use of this property : st = new String("Abcdef"); y = this.st.length; The value of y will be the number : 6
There are two courious methods that converts a string (not an object of the Class) to floating point or integer number: