Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Java Forum & Tutorial


JavaScript String Object


Reply
Views: 2039  
Thread Tools Rate Thread
  #1  
Old 05-03-2009, 05:45 PM
welcomewiki welcomewiki is offline
Member
 
Join Date: Dec 2008
Location: India
Posts: 80,538
Default JavaScript String Object

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

Try it Yourself - Examples


Return the length of a string
How to use the length property to find the length of a string.











Reply With Quote
  #2  
Old 05-03-2009, 05:46 PM
welcomewiki welcomewiki is offline
Member
 
Join Date: Dec 2008
Location: India
Posts: 80,538
The indexOf() method

How to use the indexOf() method to return the position of the first occurrence of a specified string value in a string.








Reply With Quote
  #3  
Old 05-03-2009, 05:47 PM
welcomewiki welcomewiki is offline
Member
 
Join Date: Dec 2008
Location: India
Posts: 80,538
Replace characters in a string - replace()

How to use the replace() method to replace some characters with some other characters in a string.








Reply With Quote
  #4  
Old 05-03-2009, 05:48 PM
welcomewiki welcomewiki is offline
Member
 
Join Date: Dec 2008
Location: India
Posts: 80,538
Complete String Object Reference

For a complete reference of all the properties and methods that can be used with 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 following 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 will result in the following output:
12

The following example uses the toUpperCase() method of the String object to convert a string to uppercase letters:


var txt="Hello world!";
document.write(txt.toUpperCase());

The code above will result in the following output:
HELLO WORLD!
Reply With Quote
Reply

New topics in Java Forum & Tutorial





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)