HTML and CSS Reference
In-Depth Information
String Object
The String object represents a set of characters. Any object converted to the String
object can use any of the string methods. Table G-27 summarizes the property and meth-
ods for the String object.
Table G-27 String Object
Property
Description
length
Specifies the length of the string
Method
Function
anchor()
Creates a hypertext target
big()
Displays text in a big font as if it were in a <big> … </big> tag
blink()
Blinks text as if it were in a <blink> … </blink> tag
bold()
Displays text as if it were in a <b> … </b> tag
charAt()
Returns the character at the specified location (relative index)
charCodeAt()
Returns a number indicating the Unicode value of the character at the given
location (relative index)
concat()
Combines the text of two strings
fixed(
Displays text in a fixed-pitch font as if it were in a <tt> … </tt> tag
fontcolor()
Displays text in the specified color as if it were in a <font> … </font> tag
fontsize()
Displays text in the specified font size as if it were in a <font> … </font> tag
fromCharCode()
Creates a string by using the specified sequence of Unicode values
indexOf()
Returns the index within the calling String object of the first occurrence of the
specified value, or -1 if not found
italics()
Displays a string to be italic as if it were in an <i> … </i> tag
lastIndexOf()
Returns the index within the calling String object of the last occurrence of the
specified value, or -1 if not found
link()
Creates an HTML hypertext link that requests another URL
match()
Matches a regular expression against a string
replace()
Matches a regular expression and a string, and replaces the matched substring
with a new substring
search()
Searches for a match between a regular expression and a specified string
slice()
Returns a new string from an existing string
small()
Displays text in a small font as if it were in a <small> … </small> tag
split()
Splits a String object into an array of substrings
strike()
Displays text as struck-out text as if it were in a <strike> … </strike> tag
sub()
Displays text as a subscript as if it were in a <sub> … </sub> tag
substr()
Returns the characters in a string starting at a specific location for a specific
length
substring()
Returns a substring of a string
sup()
Displays text as a superscript as if it were in a <sup> … </sup> tag
toLowerCase()
Displays a string value converted to lowercase
toSource()
Returns the source of the instance created; overrides the Object.toSource
method
toString()
Returns the object type or name of the constructor that created the object;
overrides the Object.toString method
toUpperCase()
Displays a string value converted to uppercase
Search WWH ::




Custom Search