STRING Function

RAMP-TS

STRING Function

Returns the string for a given string identification number. This function is especially useful in multilingual applications.

Syntax

STRING(iStringNumber)

Parameters

iStringNumber

The identification number of the string

 

Return Value

The string previously defined by ADD_STRING with the specified identification number or a string containing the text "String number n not found.".

Examples

If your sign-on function used the ADD_STRING() function to define multilingual strings like this based on different language codes:

ADD_STRING(1,"OK");
ADD_STRING(2,"Cancel");
ADD_STRING(3,"Customer not found");

 

Then all other scripts that needed to access a multi-lingual string would reference the function STRING(n) in their code in a language independent way. For example this code:

for (i = 0; i <= 4; i++)
{
   alert( STRING(i) );
}

 

Would display the strings:

  String number 0 not found.

  OK

  Cancel

  Customer not found

  String number 4 not found

 

Similarly, if your sign-on script had defined two strings like this:

ADD_STRING(1,"Customer number ");
ADD_STRING(2," could not be found or you are not authorized to view them.");

 

Then you could dynamically build a multi-lingual message in another script like this:

var strMessage = STRING(1) + CustomerNumber.toString() + STRING(2);
alert(strMessage);