Web Hosting Offers
See the new scripts recently added to Dynamic Drive. Click here.
Original, practical CSS codes and examples such as CSS menus for your site.
javascript tutorial Browse Advanced JavaScript Tutorial
Browse JavaScript Script resources
Browse JavaScript FAQS
JavaScript Tutorial: Browse
javascript tutorial
Buy templates
Home >> Tutorials >> Basic Javascript Tutorials

Javascript String Functions

The strings in Javascript are actually objects with a bunch of properties and functions that can be accessed .The javascript String object is used to manipulate a stored piece of text.

What's a String Function

The string's functions used to find out more about your string. For example, the string function search lets you search a string for a specified value that you supply.

It is important to note that these functions do not actually change the string itself, rather it returns a new string that you will have to store if you want to use it elsewhere.

What's a String Property?

A property is just some basic information about the object. For example, a string object has a length property which stores the number of characters in the string.

 

String Methods and Properties

The following lessons will teach you how to manipulate, count, reorder, replace, search and do just about anything else to your Javascript strings. These advanced topics will open up a whole new world of choices for the dynamic web pages you have yet to build!

MethodDescription 
anchor()Creates an HTML anchor 
big()Displays a string in a big font 
blink()Displays a blinking string 
bold()Displays a string in bold 
charAt()Returns the character at a specified position 
charCodeAt()Returns the Unicode of the character at a specified position 
concat()Joins two or more strings 
fixed()Displays a string as teletype text 
fontcolor()Displays a string in a specified color 
fontsize()Displays a string in a specified size 
fromCharCode()Takes the specified Unicode values and returns a string 
indexOf()Returns the position of the first occurrence of a specified string value in a string 
italics()Displays a string in italic 
lastIndexOf()Returns the position of the last occurrence of a specified string value, searching backwards from the specified position in a string 
link()Displays a string as a hyperlink 
match()Searches for a specified value in a string 
replace()Replaces some characters with some other characters in a string 
search()Searches a string for a specified value 
slice()Extracts a part of a string and returns the extracted part in a new string 
small()Displays a string in a small font 
split()Splits a string into an array of strings 
strike()Displays a string with a strikethrough 
sub()Displays a string as subscript 
substr()Extracts a specified number of characters in a string, from a start index 
substring()Extracts the characters in a string between two specified indices 
sup()Displays a string as superscript 
toLowerCase()Displays a string in lowercase letters 
toUpperCase()Displays a string in uppercase letters 
toSource()Represents the source code of an object 
valueOf()Returns the primitive value of a String object 

String Object Properties

PropertyDescription 
constructorA reference to the function that created the object 
lengthReturns the number of characters in a string 
prototypeAllows you to add properties and methods to the object 

 

 

 


Page contents: itechies.net - Learn how to use javascript strings.
javascript tutorial
javascript book
Buy this book