In Chapter 4 you looked at the
length — The length of the string in characters
charCodeAt() — The methods for returning the character or character code at a certain position in the string
lastIndexOf() — The methods that allow you to search a string for the existence of another string and that return the character position of the string if found
substring() — The methods that return just a portion of a string
toLowerCase() — The methods that return a string converted to upper- or lowercase
In this chapter you'll look at four new methods of the
String object, namely
search(). The last three, in particular, give you some very powerful text-manipulation functionality. However, to make full use of this functionality, you need to learn about a slightly more complex subject.
RegExp object. Regular expressions enable you to define a pattern of characters, which can be used for text searching or replacement. Say, for example, that you have a string in which you want to replace all single quotes enclosing text with double quotes. This may seem easy — just search the string ...