String Type
Enclose String constants with a single or double quote:
var mystring = "InetSoft Technology Corp."
mystring = 'InetSoft Technology Corp.'
Strings can be concatenated using the plus operator:
var str = 'Total: ' + total;
If a value concatenated to a string is of a different type, it is converted to a string automatically. Strings have many methods, with the most frequently used including: substring(), toLowerCase(), toUpperCase() and indexOf().
var str = 'abcd';
str = str.toUpperCase(); // converts to ABCD
var bIdx = str.indexOf('B'); //return 1
str = str.substring(1, 2); // return 'B'
Strings have built-in support for regular expressions. You can find a regular expression in a string using the match() or search() method:
str = 'this is a test of regular expression';
re = /test/; // create a regular expression
var idx = str.search(re); // return the position of the regular expression
| << Boolean Type | © 1996-2013 InetSoft Technology Corporation (v11.4) | Date Type >> |