Hi, I am a UiPath Beginner. Please help me with the below query.
“Alberto smith\r\n2 scored 30\r\ngoals in 21 games” This is my Input String and I need the output as “Alberto smith scored 30” using Split Fuction.
Here Two delimiters are there one is Space and slash
Please help me to split
you want to split to
Alberto smith scored 30
“goals in 21 games” ?
Thanks for your reply. No I need only “Alberto Smith scored 30” from the input
can you try this
System.Text.RegularExpressions.Regex.Split(txt, "\\r\\n")(0)+ System.Text.RegularExpressions.Regex.Split(txt, "\\r\\n")(1)
test11.xaml (6.8 KB)
This can be done using string manipulation.
But that doesn’t make sense without some business rule to it.
What is the business rule here so that we can build logic for all scenarios.
Hope this helps.
Thanks much. But Why 2 is coming after smith. PFB screenshot for your reference
Thanks for your reply nithin.
It is just a small assignment given by my tutor.
Please suggest me a solution with String Manipulation
Hi @sharu_priya ,
Here is another solution →
RemoveNewLines.xaml (5.3 KB)
Because theres a 2 in your input.
If you really want to remove the “2” you can do this
System.Text.RegularExpressions.Regex.Split(txt, "\\r\\n")(0) + System.Text.RegularExpressions.Regex.Split(txt, "\\r\\n")(1).Replace("2", "")
we are splitting by two or more characters \r\n so we have to use this function instead of the standard string.split
The String.Split function only works with single characters which is why we cant use it here
Sorry for the delay.
I have given now. Thanks much for your time:)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.