Page 164 - DCAP512_WAP_AND_WML
P. 164
WAP & WML
Notes String Library
Table 11.7
charAt() Returns a character that is placed in a specified position of a string
Compare() Compare two strings, and returns an integer that tells if the one string identical,
smaller or larger than other
Elements() Separates a string into elements, and then returns a specified element
find() Returns the position of a sub-string in a string
format() Formats a value, and returns the result
insertAt() Separates a string into elements, inserts a sub-string, and then returns the result
squeeze() Reduces all white spaces to single spaces, and returns the result
trim() Returns a string without leading and trailing spaces
Substring() Returns a string that is a specified part of another string
toString() Creates a string from a number, and returns the result
replace() Replaces a part of the string with a new string, and return the result
replaceAt() Separates a string into elements, replaces an element, and then returns the
result
length() Returns the length of a string
removeAt() Separates a string into elements, removes an element, and then returns the
result
Task Analyze what are the various standard libraries available for WMLScript?
WML Browser Library
Table 11.8
getCurrentCard() Returns the (relative) URL of the current card
getVar() Returns the value of a variable
go() Goes to a new card, specified by the new URL, and returns an empty string
newContext() Clears all variables, and returns an empty string
prev() The browser goes back to the previous card, and returns an empty string
refresh() Refreshes the current card, and returns an empty string
setVar() Sets the value of a variable, and returns true if the new value was
implemented successfully, and false if not
Lang Library
Table 11.9
abort() Aborts a WML Script and returns a message to the caller of the script
abs() Returns the absolute value of a number
characterSet() Returns the character set supported by the WML Script interpreter
exit() Exits a WML Script and returns a message to the caller of the script
float() Returns true if floating-point numbers are supported, and false if not
Contd...
isFloat() Returns true if a specified value can be converted into a float-point number
by the parseFloat() function, false if not
isInt() This validates whether the given parameter value can be converted to an
integer or not. A Boolean value is returned if the given value can be
158 LOVELY PROFESSIONAL UNIVERSITY
converted to an integer number using parseInt(value), else false is returned
max() Returns the largest value of two number
maxInt() Returns the maximum possible integer value
min() Returns the smallest value of two numbers
minInt() Returns the minimum possible integer value
parseInt() Returns an integer defined by a string
random() Returns a random integer between 0 and a specified number
seed() Initializes the random number generator with a number, and returns an
empty string
parseFloat() Returns a floating point value defined by a string