Free Tutorials, Linux Command, Source Code Architecture,  Software Engineering, Intelligent Systems, RDBMS, Computer Accounting,  Operations Research, Discrete Mathematics, Network, SAD Lay Networks Lay Networks
Computer Science Networking Operating Systems Linux and Unix Source Code Script & Languages Protocols Glossary

Web laynetworks.com
Google
 

WMLScript Reference
 

 

<<Back   1  2  3   Next>>

 

Maxfloat


Usage:
maxFloat( )

Parameters: None

Returns: The maximum size floating point number that can be represented

Comments: The will tpically be 3.4028235E38

Example: x = Float.maxFloat ( ) ;

// x is assigned the value 3.4028235E38

Minfloat


Usage: minFloat( )

Parameters: None

Returns: The smallest non-zero floating point number that can be represented

Comments: This will typically be 1.

Example: x = Float.minFloat ( ) ;

// x is assigned the value 1.17549435E-38

Pow


Usage: pow(number1, number2)

Parameters: number1-a floating point number

Number2-a floating point number

Returns: The result of raising number1 to the power of number2

Comments: This function performs the calculation (number1)number

Example: x = Float.pow(2.5, 3) ;

// x is assigned value 15.625

round


Usage: round(value)

Parameters: value- a floating point number

Returns: An integer as a result of rounding the value

Comments: The normal mathematical rules for rounding apply.

Example: x = Float.round(3.7);

// x is assigned value 4

sqrt


Usage: sqrt(value)

Parameters: value – a floating point number

Returns: The result of taking the square root of the number

Comments: If an attempt is made to take the square foot of a negative number, it returns invalid

Example: x = Float.sqrt (31.36)

// x is assigned value 5.6

Lang


This library contains core WMLScript functions.

abort


Usage: abort(message)

Parameters: message – an error message of type string

Returns: None

Comments: This function stops the current execution of WMLScript and hands control back to the browser

Example: Lang.abort (*calculation failed)

abs


Usage: abs(numbers)

Parameters: numbers – numbers of any number type

Returns: The absolutes value of the number

Comments: The return type is of the same type as the parameter passed to the function

Example: x = lang.abs(-3)

// x is assigned value 3

characterSet


Usage: characterset()

Parameters: None

Returns: Am integer that type is of the same type as the parameter passed to the function

Comments: See ftp://ftp.isi.edu/in -notes/iana/assignments/character-sets for list of character sets

Example: x = lang.characterset();

/ / x is assigned the integer that represents the present character set

exit


Usage: exit(value)

Parameters: value – a number of any type

Returns: None

Comments: This funcion stops the execution of the script and returns control to theWMLScript interpreter.

Example: Lang.exit(3):

x = 6;

// The script is exited with return value of 3

// The assignments never takes place.

float


Usage: float()

Parameters: None

Returns: A Boolean indicating whether the interpreter supports floating point numbers

Comments: The results of this function will obviously vary from one browser to another

Example: x = lang.isfloat (“3.53322”);

// x is assigned the value true

isint


Usage: isInt(value)

Parameters: value – a value of any type

Returns: A Boolean indicating whether the value can be successfully converted to an integer

Comments:

Example: x = Lang.inInt (“1243”);

// x is assigned the value true

max


Usage: max(number1, number2)

Parameters: number1 and number2 are numbers of any numerical type

Returns: The larger of the two numbers.

Comments: If the number are the same in size then the first is returned

Example: x = Lang.max(8, 12.4);

// x is assigned 4.5

minInt


Usage: minInt()

Parameters: None

Returns: The smallest integer supported by the browser

Comments:

Example: x = Lang.minInt();

// x is an integer and has the smallest value that an integer can be


parseInt

Usage: parseInt(value)

Parameters: value, which is the string to be converted

Returns: The result of converting the value to an integer

Comments: If this cannot be done, the function returns invalid

Example: x = Lang.parseInt (“5”);

/ / x is an integer with value 5

random


Usage: random(value)

Parameters: value – the highest number that will be acceptable

Returns: An integer randomly closen from the range ()-value

Comments: The value parameter must be a positive number

Example: x = lang.random(5);

// x is an integer anywhere in the range 0-5

seed


Usage: seed (value)

Parameters: value-a value to seed the random number genetator

Returns: An empty string if the function succeeds

Comments: This function should be used before the random function for best results

Example: x = Lang.random(5);

// x is an integer anywhere in the range

string


The string library contains functions for the manipulation and conversion of strings.

CharAt


Usage: charAt(string, number)

Parameters: string-a string

Number-an integer offset for the string

Returns: The character from the string at the position given by the number

Comments: The numbering of positions starts at 0

Example: x = String.charAt(“Hello world”, 6);

// x is assigned “w”

compare


Usage: compare(string1, string2)

Parameters: string1 and string2 – both of string type

Returns: -1 if string1 < string2

Comments: 1 if string1 > string2

0 if string1 = string2

The result of this calculation is of course dependent upon the character set that is used

Example: x = string.compare(“a string”, a string”);

// x is assigned the number 3

elementAt
Usage: elementAt (string,index,separator)

Parameters: string and separator – strings

 

Index – an integer index

 

Returns: The element in the string at the given index where an element is a section divided by the separator

Comments: The indexing of the elements starts from 0

Example: x = String.elementAt(“This has, three, elements”, 1, “,”);

//x is assigned “three”

find

 

Usage: find(string, sub)

Parameters: string-a string Sub- a substring to find in the string

Returns: An integer index of where the substring appears in the string

Comments: The indexing starts from 0

Example: x = string.find(“this is a string “, is”);

// x is assigned the number 5

format


Usage: format(format, value)

Parameters: format – a formatting string Value – value to be converted to a string using the formatting string Parameter

Returns: The result of formatting the value using the forma parameter

Comments: A formatting string is a string that can contain a format specifier. This format specifier begins with a % and can then be followed by a width or precision before its type is given. The three formatting types are d – integer, f – floating point and s – string. So, to give a format parameter that means “seven characters wide with an integer” use:%7d. To give a format parameter the means “ seven characters wide, with a precision of four” and using an integer, use: %7.4d

Example: x = Stromg.format (“Number-%7.4d”, 12);

// x is assigned “Number- 0012”

insertAt


Usage: insertAt (string, element, index, separator)

Parameters:string- the string into which the new element is to be inserted

Element-the new string element that is to be inserted Index-the index in the index in the string where the element is to be inserted separator-the string that is used to separate the different elements

Comments: The indexing starts at 0

Example: x = string.insertAt(“one, two, three”, “one and a half”, 1, “,”);

// x is assigned “one, one and a half, two, three”

length


Usage: length (string)

Parameters: string-the string to calculate the length of

Returns: The length of the string passed as a parameter

Comments:

Example: x = String.length (“Hello”) ;

// x is assigned 5

isEmpty


Usage: isEmpty (string)

Parameters: string-the string, that we want to test for being empty

Returns: A Boolean indicating whether the string has length 0 or not

Comments:

Example: x = String.isEmpty(“”);

// x is assigned true

removeAt


Usage: removeAt (string, index, separator)

Parameters: string- the string to remove an element from Index –the position of the element to be removed Separator- the string that is used to separate the elements

Returns: A string with the elements at the given index removed

Comments: Indexing starts from 0, an element is defined as a section of the string separated by the given separator

Example: x = string.removeAt(“zero, one, two”, 1,”,”) ;

// x is assigned “zero, two”

replace


Usage: replace(string, old, new)

Parameters: string-a string, which will have some of its substrings replaced old- a string which is to be replaced new- a string to replace the old string with

Returns: The result of substituting the substring new into the string for every substring old

Comments:

Example: x = String.replace(“Hello, world!”, “goodbye”);

// x is assigned the value “Hello, goodbye!”

replaceAt


Usage: replaceAt (string, element, index, separator)

Parameters: string-a string of elements Element-an element to be inserted into the string at the given index index - the position within the string of the element to be replaced separator-the string which divides the elements

Returns: The result of replacing the element at the index in the string with the string given by the element parameter, where elements in the string are divided by the given separator

Comments: The index starts from 0

Example: x = String.replaceAt (“zero, one, two”, “1”, 1, “,”) ;

// x is assigned “zero, 1, two”

squeeze

 

Usage: squeeze(string)

Parameters: string-the string tobe squeezed

Returns: A string where all whitespaces have been reduced to a single space character

Comments:

Example: x = String.replaceAt(“zero, one, two”, “1”, 1, “,”) ;

// x is assigned “zero, 1, two”

squeeze


Usage: squeeze(string)

Parameters: string-the string to be squeezed

Returns: A string where all whitespaces have been reduced to a single space character

Comments:

Example: String.squeeze(“Hello, goodbye ! “);

// x is assigned the value “Hello, goodbye !”

subString


Usage: substring(string, index, lingth)

Parameters: string- the string to take the substrin from Index-the position in the string to take the substrin from Length – the number of characters to take from the string for the substring

Returns: A substring, formed by taking a string of the given length from the given string at the position given by the index

Comments:

Example: x = String.subSstring(“Hello world!”, 6, 5) ;

// x is assigned “world”

trim


Usage: trim(string)

Parameters: string – the string to be trimmed

Returns: The string with all leading and trailing whitespace removed

Comments:

Example: x = string.trim(“ Hello, world! ”);

// x is assigned “Hello, world!”

toString


Usage: toString(value))

Parameters: value – the value to be converted to a string

Returns: The result of converting the value to its string representation

Comments:

Example: x = string.toString(27);

/ / x is assigned the string “27”

Top

<<Back   1  2  3   Next>>

 

 
FDDI Frequently Asked Questions (FAQ), The function and frame format of FDDI,Aloha,Comparative analysis between two types of ATM Switches,Knockout Switch,Barcher-Banyan Switch,Various popular standards for compressing multimedia data,Distributed Multimedia Survey: Standards, ASCII to hex value chart,Comparative analysis - TCP - UDP, Addressing Formats and QoS parameters, Bellman Ford's Algorithm Lay networks, free, java, java script, asp, vb, linux, ignou, tutorial, Unix commands, System Analysis, System Design, Ipv6, quiz, download, free, Computer Architecture, Object Oriented System, Relational Database Management Systems, Object Oriented System, Operating Systems, Software Engineering, Communications and Networks, Discrete Mathematics, Intelligent Systems, Operations Research, Accounting and Finance on Computersmca, networking, protocols, glossary, assignment, project, tma, programming source code, programming, source code, unix, free
 
Book Mark/Share this site at BlinkBits BlinkList Blogmarks co.mments Delicious Digg Fark Furl it! Google Ma.gnolia Netvouz NewsVine RawSugar Reddit Shadows Simpy Stumble Technorati YahooMyWeb

Copyright © 2000- 2007 Lay Networks All rights reserved. 
This website is best viewed in Firefox 1.0.1 above.

Web Hosting sponsored by Customized Software Company India
Web Site Designed by Web Designing, Flash Animation, Multimedia Presentations, Broacher/catalogue designing, Web Promotion 
Refer to your freind About Us Legal IGNOU Contact Us Feedback Donate to laynetworks.com Download Management Tutorials Tutorials History Search here