Hi All,
Simple way to concatenate String in x++ is using plus(+) sign or strFmt function.
List of concatenating methods in x++:
strFmt
str ss = strFmt('Name=%1, Surname=%2, Phone Number=%3', nameStr, surnameStr, phNum);
+ Sign
str ss = 'Name=' + nameStr+ ', Surname=' + surnameStr+ ', Phone Number=' + phNum;
System.String::Concat
System.String s1 = System.String::Concat('Name=', nameStr);
System.String s2 = System.String::Concat(', Surname=', surnameStr);
System.String s3 = System.String::Concat(', Phone Number=', phnNum);
System.String s4 = System.String::Concat(s2, s3, ', Gender=', genderStr);
str s5 = System.String::Concat(s1, s4);
System.Text.StringBuilder
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("Name=");
sb.Append(nameStr);
sb.Append(", Surname=");
sb.Append(surnameStr);
sb.Append(", Phone Number=");
sb.Append(phnNum);
str result = sb.ToString();
info(result);
The Result:1000000 strFmt took 0.00 milliseconds in average, in total 3398 1000000 +ing took 0.00 milliseconds in average, in total 1843 1000000 System.String::Concat took 0.00 milliseconds in average, in total 655 1000000 System.Text.StringBuilder took 0.00 milliseconds in average, in total 896Reference: http://devlicious.net/