OPERATOR:  string:  +  +=

The string operators are used to join strings together. This is referred to as concatenation.
Note the String library contains several useful functions for manipulating strings.
There are two string operators:
The + operator joins two strings together to create a third string. The second string is simply added directly onto the end of the first string. No extra characters or blank spaces are automatically added. (You may wish to add blank spaces for appearance.)
The += operator modifies a string by joining a second string onto the end. The new string contains both strings.
Code for StringOpExample.wml
<?xml version="1.0"?>

<card id="card1">
   string operators example
   <do type="accept">
      <go href="StringOpExample.wmls#findstringop()" />

<card id="card2">
   1st string = $(concatstr1)
   <br />
   2cd string = $(concatstr2)


Code for StringOpExample.wmls
extern function findstringop()
   var str1 = "A blue moon ";
   var str2 = "is made of ";
   var str3 = "bleu cheese.";
   var catstr1 = str1 + str2 + str3;
   WMLBrowser.setVar("concatstr1", catstr1);
   var str10 = "I love you ";
   var str11 = "very ";
   var str12 = "much!";
   for( var cnt = 1; cnt < 5; cnt++)
      str10 += str11;
   str10 += str12;
   WMLBrowser.setVar("concatstr2", str10);

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information