News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

How to find the Length of string in Java Script ? ? ?

Started by thiruvasagamani, Jul 11, 2008, 07:53 PM

Previous topic - Next topic

thiruvasagamani

Function to find the length(len()) of a string

While working with strings often we need to find a length of string, count of charachers etc. Basically a developer who has a very good knowledge in vb may look for the equivalent of len() in javascript as in VB.  Which is primarily used for finding the length of string.

In JavaScript we have to use the string related function as the [variable]. [function name.] In this Case it is strInput.length();

If you are placing this function in a common JavaScript file or anywhere in the same page's script block. Then we can straight away call the Len function as we do in VB.

function Len(strInput)
{
      return strInput.length;
}
Thiruvasakamani Karnan