Separate from strings

Hi,

I have a string and i want to take values separately i.e (13424) and (“h2go bfree Fusion Sport Bottle - 23 oz.”) then how i do.

13424 h2go bfree Fusion Sport Bottle - 23 oz.

Regards,

You can use below codes :slightly_smiling_face:

  • String1=left( inputString,5)
  • String2= inputString.replace(String1,“”).trim
2 Likes

Hi Rup

If the first element length is dynamic you can split the string by space and take the first element for the first part. Then use join with delimiter and skip for the rest.

 a = theString.Split(' ')
 firstElem = a.First()
 restOfArray = string.Join(" ", a.Skip(1))

Above is taken from this link reformatted in vb syntaxt and untested

https://stackoverflow.com/questions/12961868/split-and-join-c-sharp-string

2 Likes

Hi mgosal,
I want to fetch value separately from above pdf then how i do.Capture

Regards,

Hi

You can use any one of the two approach given below:

1. Split String:
String firstPart = fullstring.Trim.Split(“ “.ToCharArray()).First

You will get the first word in string variable firstPart. Then you can replace it from fullstring provided it is unique word.

String secondPard = fullstring.replace(firstPart,””).Trim

2. Regular Expression:
You can use match activity to extract the number from the string.
Input: fullstring
Expression : “\d{4,}”

2 Likes

Hi,
Sorry for late response.
the code which you provide,i am able to fetch “297”,“1”,“1”
Here is full string and i have to separate values like :-

297 13424 h2go bfree Fusion Sport Bottle - 23 oz. 2.7750 824.18
0 - (Base, Trim) : Translucent Graphite , Stainless
Steel
1 Set-Up Charge Set-Up Charge 44.0000 44.00
1 *Prepro Proof Charge Prepro Proof per Color 24.0000 24.00

and i have to pick values like “297”,"13424 ",“h2go bfree Fusion Sport Bottle - 23 oz.”

when i use this regex then i got 0000 for string that i dont want then how i do.

Hi Rup_1,

Sorry I don’t have access to UiPath at the moment but can you replicate the code in screenshot into UiPath.

Thanks,
-Nitin

Hi,
I really appreciate for your efforts.i get for output for one cases but it seems to be an error in some cases kindly you can check where i go wrong.
Here is my workflow:-
Main (11).xaml (66.5 KB)
SampleExcel_1.xlsx (11.5 KB)

Hi Rup_1,

Please check the xaml in attachment.
I have ignored the total amount from the SampleExcel_1.xlsx and added an index field in output excel .
You can filter the output excel on index field and calcuate the amount by adding the cost.
Description field is not as accurate as it should be. But I think you can work with it as it has required keywords.

StringManipulation.xaml (31.2 KB)
Output.xlsx (15.9 KB)

Hi bro,
it works great but from Item# section we want only numeric value not the string value.

  • i also try to achieve output by spliting by space then string value also we get.and that we don’t want.

You can use regex \d+ to check if it number.

I had made the logic as per the output excel provided by you.