Hi All, i struct in splitting a string can anyone suggest me how to split a string.
Input EX: 1) CNP-46TAC9 2020-01-POC-RC6
2) 2021-KC-MNC-Pro
Output: CNP
46TAC9
2020
01
POC
RC6
Output 2: 2021
KC
MNC
Pro
Hi All, i struct in splitting a string can anyone suggest me how to split a string.
Input EX: 1) CNP-46TAC9 2020-01-POC-RC6
2) 2021-KC-MNC-Pro
Output: CNP
46TAC9
2020
01
POC
RC6
Output 2: 2021
KC
MNC
Pro
Hi @Learner007
Use the below expression to split!
InputString.Split("-"c)
And Use For each to iterate the string values
Regards
Hi @Learner007 ,
Since we are getting different combinations first we have to replace the blank space with the keyword - like below.
Yourstring.replace(" β,β-")
Now please follow the suggestion by @pravin_calvin .
Yourstring.split("-βc)(0) β to get the first one.
Yourstring.split(β-"c)(1) β to get the second one so on.
or you could use string arry to capture all the entries like below.
strarr = Yourstring.split("-"c)
and use for each loop to get all the splitted strings one by one. thanks.
Hi @Learner007 !
Welcome to UiPath Community
Here is a suggestion: Split data.xaml (8.0 KB)
Hi @kirankumar.mahanthi1 some time iβm getting 2 or 3 spaces is there any way to replace at a time or i need to replace activity multiple times
try this:
yourString.Split(New String(){" β,β-"},StringSplitOptions.None)
Thanks
pravu.
Replace activity replace all the blank spaces to key word at a time. No need to use multiple times or use some valuable suggestion given by the other members in this thread. Thanks.
hi @Jobin_Joy this is working for single space , some times i will get 2 or 3 spaces in between i want to replace them by (-) how can i replace multiple spaces into single value (-)
Hi @Learner007
Please use the below code for your requirement.
Updated Code:
Main (1).xaml (7.2 KB)
Hope this will be helpful. Thank you.
Thanks @Jobin_Joy itβs working
Glad to hear that itβs helped you. Thank you.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.