0% found this document useful (0 votes)
20 views

24 String Object

The String object in JavaScript is used to manipulate text. It allows getting the length of a string, searching for substrings using indexOf and match, and replacing characters using replace. The complete reference for all String object properties and methods is also available.

Uploaded by

BaneeIshaqueK
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

24 String Object

The String object in JavaScript is used to manipulate text. It allows getting the length of a string, searching for substrings using indexOf and match, and replacing characters using replace. The complete reference for all String object properties and methods is also available.

Uploaded by

BaneeIshaqueK
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

JavaScript String Object

The String object is used to manipulate a stored piece of text.


Try it Yourself - Examples
eturn the length of a string
!o" to use the length property to find the length of a string.
Style strings
!o" to style strings.
The indexOf#$ method
!o" to use the indexOf#$ method to return the position of the first occurrence of a specified string
value in a string.
The match#$ method
!o" to use the match#$ method to search for a specified string value "ithin a string and return the
string value if found
eplace characters in a string - replace#$
!o" to use the replace#$ method to replace some characters "ith some other characters in a string.
%omplete String Object eference
&or a complete reference of all the properties and methods that can be used "ith the String object'
go to our complete String object reference.
The reference contains a brief description and examples of use for each property and method(
String object
The String object is used to manipulate a stored piece of text.
Examples of use:
The follo"ing example uses the length property of the String object to find the length of a string)
var txt="Hello world!";
document.write(txt.length);
The code above "ill result in the follo"ing output)
12
The follo"ing example uses the to*pper%ase#$ method of the String object to convert a string to
uppercase letters)
var txt="Hello world!";
document.write(txt.toUpperCae());
The code above "ill result in the follo"ing output)
H!""# $#%"&!

You might also like