adda number to text?

hi. i have a text with 2 letters and 8 numbers that looks like "AB00000001" that is in a text data item. i want to add +1 to the number. how do i do this when it is text format?
thanks
 

ewilson

Member
Here's one example that you could implement with a Code stage:

C#:
string val1 = "AB00000001";
string val2 = "AB00000002";
int sum = Convert.ToInt32(val1.Substring(val1.Length - 8)) + Convert.ToInt32(val2.Substring(val2.Length - 8));
string finalVal = "AB" + sum.ToString("D8");

This assumes the numeric portion of the string will always be 8 characters long.

Cheers,
Eric
 
Top