Getting the Number of Characters in a String: length() Function

Preferences - Do not show ads

The length() function helps us get the number of characters in a string. Its syntax is:


String.length(string);


If the function call succeeds, length() returns the number of characters contained in string. It returns invalid if any error occurs.

The following WMLScript examples demonstrate the use of length():


var len = String.length("WMLScript Tutorial");

After executing the above line of script, the len variable has the value 18.


var len = String.length(12345);

After executing the above line of script, the len variable has the value 5.


Previous Page Page 41 of 71 Next Page

Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






WMLScript Tutorial Table of Contents WMLScript Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page