Name
String — support for strings
Availability
Core JavaScript 1.0; enhanced in Navigator 3
Constructor
new String(value) // JavaScript 1.1Properties
- length
The length of a string. JavaScript 1.0; ECMA-262.
Methods
- anchor(name)
Add an HTML anchor to a string.
- big()
Make a string
<BIG>.- blink()
Make a string
<BLINK>.- bold()
Make a string bold with
<B>.- charAt(n)
Get the nth character from a string. JavaScript 1.0; ECMA-262.
- charCodeAt(n)
Get the nth character code from a string. JavaScript 1.2; ECMA-262.
- concat(value, . . . )
Concatenate strings. JavaScript 1.2.
- fixed()
Make a string fixed-width with
<TT>.- fontcolor(color)
Set a string’s color with
<FONT>.- fontsize(size)
Set a string’s font size with
<FONT>.- indexOf(substring, start)
Search a string. JavaScript 1.0; ECMA-262.
- italics()
Make a string italic with
<I>.- lastIndexOf(substring, start)
Search a string backward. JavaScript 1.0; ECMA-262.
- link(href)
Add a hypertext link to a string.
- match(regexp)
Find one or more regular expression matches. JavaScript 1.2.
- replaceregexp (replacement)
Replace substring(s) matching a regular expression. JavaScript 1.2.
- search(regexp)
Search for a regular expression. JavaScript 1.2.
- slice(start, end)
Extract a substring. JavaScript 1.2.
- small()
Make a string
<SMALL>.- split(delimiter)
Break a string into an array of strings. JavaScript 1.1; ECMA-262.
- strike()
Strike out a string with
<STRIKE>.- sub()
Make a string a subscript with
<SUB>.- substring(from, to)
Return a substring of a string. JavaScript 1.0; ECMA-262.
- substr(start, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access