W3Schools.com


  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE... REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript String Object

« Previous Next Chapter »

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


Examples

Try it Yourself - Examples

Return the length of a string
How to return the length of a string.

Style strings
How to style strings.

The toLowerCase() and toUpperCase() methods
How to convert a string to lowercase or uppercase letters.

The match() method
How to search for a specified value within a string.

Replace characters in a string - replace()
How to replace a specified value with another value in a string.

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


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!

« Previous Next Chapter »


Stylus Studio® XML Development Environment

stylus

Stylus Studio® 2011 XML Enterprise Suite raises the bar for productivity in XML development tools. Millions of XML developers and data integration specialists turn to Stylus Studio's comprehensive and intuitive XML toolset to tackle today's advanced XML data transformation and aggregation challenges.

stylus
  • XML Pipeline Editor, Debugger and Code Generator
  • DataDirect XML Converters
  • XQuery Mapper, Editor, Debugger, and Profiler
  • XSLT Mapper, Editor, Debugger, Designer, and Profiler
  • Java and C# for .Net Code Generation
  • XML Schema Designer With Documentation Generator
  • XML Editor With Full XPath Integration

Download a free trial now



 
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
Top Web Hosting
$1 Domain Sale
WEB BUILDING
XML Editor – Free Trial!
FREE Flash Website
6,000+ HTML Templates
Download now (FREE)
Advertise on Google
Stand out on Google search and maps Click Here
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE