Issue with the Convert string value in Nav 2009 r2

Dear Friends,

I have a small issue with string conversion. That is remove alphabets from alphanumeric string.

Ex 1: Order Id = " Flipkart Order id # 141-500121" need to convert in to “141-500121”

Ex 2: Order id = “Amazon Order id # OD500121” need to convert in to “OD500121”

Can anyone please help me…

If the format pattern that I see in your example strings hold true for all strings, you can use STRPOS to locate the '# ’ substring, and COPYSTR to capture the remainder of the string.

hi,

use dotnet class Regex.

variables:
Name DataType Subtype Length
Regex | DotNet | System.Text.RegularExpressions.Regex.‘System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’
Match | DotNet |System.Text.RegularExpressions.Match.‘System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’

the code:
Match := Regex.Match(‘h123xxx’, ‘\d+’); // text value = h123xxx
MESSAGE(Match.Value); // gives you 123

hi,

you can also convert the # sign to , (comma) using the CONVERTSTR function.

then with SELECTSTR you can split the string: SELECTSTR(2, InputStr)

Hi Sri, Just a follow-up question because I think it’s key … can you tell us whether this pattern that’s seen in your example data, where the substring you’re after follows a ‘#_’ sequence, will be a universal truth across all possible values that you’re trying to parse, or is it just true for these two examples? And will the substrings you’re after always be alphanumeric, or is that too just specific to the sample data?

We could suggest pages of different ways to manipulate a string, but unless we can define a rule for separating the wheat from the chaff in this case, it would all just be an academic exercise.

Hi friends,

Thanks for your replies. Those are very helpful to me,