Hi,
I have the below mentioned input string:
Layer 2 - B - 16% - 3P1-5204-00
Layer 2 - H - 16% - HP1-5204-00
Layer 2 - M - 60% - 10570593
Layer 2 - P- 8% - PP1-5204-00
Layer 3 - B - 7.2% - 3P1-5205-00
Layer 3 - E - 18% - FP10026964-2021-S
Layer 3 - H - 7.2% - HP1-5205-00
Layer 3 - L - 14% - PX21NE441W3X
Layer 3 - M - 50% - 10570593
Layer 3 - P - 3.6% - PP1-5205-00
Layer 4 - S - 100% - 1073566.P4.1-1-0
And this is my expected output:
Layer 2 -
B - 16% - 3P1-5204-00
H- 16% - HP1-5204-00
M - 60% - 10570593
P - 8% - PP1-5204-00
Layer 3 -
B - 7.2% - 3P1-5205-00
E - 18% - FP10026964-2021-S
H - 7.2% - HP1-5205-00
L - 14% - PX21NE441W3X
M - 50% - 10570593
P - 3.6% - PP1-5205-00
Layer 4 -
S - 100% - 1073566.P4.1-1-0
Is it possible to achieve this through string manupulations.
varunk
(Varun Kumar)
2
Hi Ritika Singh,
Yes we can able to achieve it using string operations.
Try with split you will get it below syntax for your reference,
Variable.Split(“-”.ToCharArray)(1)
Regards,
Varun
Hi @Ritika_Singh ,
Is this what you were looking for?


LayersString.xaml (7.3 KB)
Kind Regards,
Ashwin A.K
Hi ashwin,
Thank you for your response , I have a small query.
The number of layers are dynamic, & can vary. Will this work then as well?
Gokul001
(Gokul Balaji)
5
HI @Ritika_Singh
Try this expression
System.Text.RegularExpressions.Regex.Match("Inputstring","(?<=Layer\s\d{1}\s-)(.*)").Tostring

Regards
Gokul
Gokul001
(Gokul Balaji)
6
Hi @Ritika_Singh
Try this expression
System.Text.RegularExpressions.Regex.Match("Inputstring","(?<=Layer\s\d\s-).*|(?<=Layer\s)\d+\s-\s(.*)").Groups(1).Tostring
Regards
Gokul
Tricky, but somewhat doable.
You could try passing in a List of the Layer numbers or the count and proceed from thereon.
LayersString_v1.xaml (9.9 KB)
Kind Regards,
Ashwin A.K
Gokul001
(Gokul Balaji)
8
Hi @Ritika_Singh
Have you try the expression,
Let us know if you are facing any challenges
Regards
Gokul
Hi, It is not giving the required result. I have used some other way , and my issue is resolved .Thanks a lot for your response
carmen
10
Hi @Ritika_Singh ! Can you share how you did it ?