String operations

studio
variable
string

#1

Hi guys, can anyone help me with below issue.
Let us take example as 88118B345673.
In above example the alphabet may be B or C and I want the value which is after B only if the alphabet is either B or C.


#2

Please refer to attached. This code is not optimized but serves your purpose.

String.xaml (7.2 KB)

Thanks and regards,
Viswa.


#3

Alternatively you could use a regular express match object to search for the match of either a B or a C and then use string manipulation to grab the substring of the characters after the index of the match

Regex.xaml (6.1 KB)


#4

Hi @harinathreddy.yn

use String Variable as StrFirstName.toString.Substring(0,6)

Thanks
Ashwin S


#5

Great bro it works, thanks


#6

This expression “[B-C]” serve as B or C right ? or else will it serve as B to C?


#7

Its range. In present context, for example [B-D] means, either B or C or D.

For more details take a look at :https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference#character-classes

And search for ‘Character range:’


#8

Can I use same way for other examples like [1-9] will it work?


#9

Yes it will


#10

thank you