WMLScript » String » +=

Syntax:
+=

The += operator modifies a string by joining a second string onto the end. The new string contains both strings.




Examples

Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

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

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

</wml>
Explanation:

Code for StringOpExample.wml.

Language(s): WML
Code:
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);
   WMLBrowser.go("StringOpExample.wml#card2");
};
Explanation:

Code for StringOpExample.wmls.

Language(s): WML

See Also: