Advertising banner:
 
 
 A156
 
81203_43854_21.png81203_43840_19.png



The following is an alphabetical listing of Internet Services script functions along with a brief description of their syntax and function. For an introduction to functions, see About Internet Services script library.



escape
Escapes reserved characters in the argument 'String' in the C-style (prefixing each reserved character with a backslash (\)). This allows the resulting string to be used safely in C-style scripting languages (for example, JavaScript).
The default set of reserved characters is quote ('), double-quote ("), carriage-return (ASCII 13), line feed (ASCII 10) and backslash (\). Additional characters to escape can be configured using the <!--#config escapechars=""--> command in the IS script commands document.
Syntax
@escape(String)
Example
<!--#set var="str" value="This is a #string\n, with \"characters\" that 'need' escaping: '"-->



indexof
Returns the index of the first occurrence of Key in String.
If Key does not occur in String, the function returns -1. Key can be one or more characters, and the search comparison is case-sensitive.
Syntax
@indexof (String, Key)
Example
<!--#set var="n" expr="@indexof ('abcdef012345', 'c')" -->
<!--n now contains "2" -->
<!--#set var="n" expr=@indexof (abcdef012345', 'ef01')"-->
<!--n now contains "4"-->
<!--#set var="n"expr="@indexof ('abcdef012345', '/ [Cc]/') "-->
<!--n now contains "2" -->
<!--#set var="n"expr="@indexof ('abcdef012345', 'z')"-->
<!--n now contains "-1" -->



length
Returns the length of the argument String.
        Note
The length returned is in bytes, which depending on the current character may or may not  be the same as the number of characters.
Syntax
@length(String)
Example
<!--#set var="len" expr='@length($name)"-->
<!--#if expr="$len <5"--> Please enter at least 5 characters<!--#endif-->



list
Extracts a string from a static (enumeration) list, see FirstClass Designer.
Syntax
@list(<string>, <value>)
where,
<string> is a zero-based increasing list of elements, separated by a comma
An equal sign followed by a decimal number can be used to override the index value of that  element and subseequent elements.
<value> is the zero-based index value.
If the index is outside of the range of elements, then an empty string is returned, otherwise the corresponding element is returned.
Example
@list("one;two;four=4;five", 2) returns the string 'two',
@list("one;two;four=4;five", 4) returns 'four'
@list("one;two;four=4;five", 3) returns '' (empty string)



lower
Returns the argument String with all characters converted to lower case.
        Note
The behavior of this function in character sets other than ASCII / ISO-8859-1 is undefined.
Syntax
@lower(String)
see @upper
Example
<!--#set var="str" expr="@lower('This is a mixed case string')"-->
<!-- str now contains "this is a Mixed Case String" -->



rand
Returns a random number between 0 and 32767.
Syntax
@rand()
Example
<!--#set var="num" expr="@rand()"--><!--#set var="smallnum" expr="@rand()%5"--><!-- smallnum is limited to values from 0 to 4, inclusive -->



split
Decode lists with constant separator characters.
The @split function's behavior is roughly similar to the C strtok function. When called, this function finds and returns the contents of String up to (but not including) the first occurrence of Separator. If Separator does not occur in String, then all of String is returned. If String is an Internet Services script variable then the portion returned, plus the first occurrence of Separator, are removed from it.
@split now has added regexp support.
Syntax
@split(String, Separator)
Example 1
If you have two Internet Services script variables called "VAR1" and "VAR2" and VAR1 initially has the value "Value1;Value2":
After the first call
<!--#set var="VAR2" expr="@split($VAR1, ';')"-->
VAR2 will contain the value "Value1" (everything up to but not including the first incidence of the seperator ';')
VAR1 will contain the value "Value2" (everything transferred to VAR2 is removed, plus the seperator ';')
After the second call
<!--#set var="VAR2" expr="@split($VAR1, ';')"-->
VAR2 will contain the value "Value2" (since there is no incidence of the seperator ';' , the whole string is returned)
VAR1 will contain the value "" (everything transferred to VAR2 is removed leaving nothing).
Example 2
With added regexp support:
@split("This (is) a test", "/(.+)/") will return "This "



substr
Extracts a substring of the argument String, starting at the character specified by StartIndex, and ending at EndIndex.
If EndIndex is not provided, the whole remainder of the string after StartIndex is returned.
        Note
Like the C programming language, the indexes of the characters are 0, based not 1 based, so a start index of '3' is actually the 4th character not the third.
Syntax
@substr (String, StartIndex, EndIndex)
Example
<!--#echo expr="@substr('abcdef',1,3)
Result: bcd



upper
Returns the argument String with all characters converted to upper case.
The behavior of this function in character sets other than ASCII / ISO-8859-1 is undefined.
Syntax
@upper (String)
        Note
If the string might be interpreted as a number, you must enclose it in single quotes, in order to ensure the correct functionality, for example, @upper('10').
Example
<!--#set var="str" expr="@upper ('This is a Mixed Case String')"-->
<!-- str now contains "THIS IS A MIXED CASE STRING"-->



URLescape
Returns a copy of the argument String escaped in a manner suitable for use in an URL.
For a description of how characters are made "URL friendly", see section 3.2 of RFC 2616.
Syntax
@URLescpate(String)
Example
<!--#echo expr="@URLescape('This is a #1 message')"-->
Result: This%20is%2oa%20%231%20message.



hirosue Shino Web Site