Hi, I am new to uipath and I am having this simple query. I need to get text “ANALYTICS_Security.20190503.tar.gz” from text “ANALYTICS_Security.20190503.tar.gz 7728766 bytes”.
In other words, I need to get text from beginning to the first space (" “). Any help on it would be much appreciated. NOTE: The space mentioned above can be single(” “) or multiple spaces(” "). Thanks!
hi palaniyappan,
My input string will vary below are the some sample input strings
SSC2BRS_cpn_in_20190506_XLC.txt 5779 bytes
SSC2BRS_secd_camra_20190506.CSV 252 bytes
BRS2MARKIT_Decode.20190506.XML 5446782 bytes
BRS2MARKIT_IndexWeights.20190503.tar.gz 75060 bytes
we have to retrive the first part in each input string.
Thanks
Fine then you can use this
doesn’t matter the number of space between the first and second, as we are not going to get the word followed by a space, we are going to get only before the space, so this would work for sure in all scenarios
out_text = split(in_text," ")(0).ToString.Trim
This worked again @Ramya12
Though it has varying number of space between
we are getting the value we need
where outtext_array is a variable of type string array, which has the array of lines from the read text file
now use a for each loop with the above variable “outtext_array” as input and change the type argument of for each loop as string
the inside the loop use a write line activity and give input like this
Hi @Palaniyappan , sorry for bothering you again but I am reading those input texts from email and this is how those texts looks like when seen in output after writing through writeline,
I have attached the snapshot from output as well where I have highlighted these texts. I want to retrive the highlighted portion of the text. I would be great if you could help me with same. Or you can help me with finding the last position on Dot “.” so that I can do substring on it with length as 3 more than last postion of Dot. For example,
–lets take like you have the string stored in a variable named strinput
–then use a Matches activity where in the input mention as strinput and in expression mention as “^.*(?=\s)”
–this will store all the values we need in a variable of type System.Collections.Generic.Ienumerable(System.Text.RegularExpressions.Match) and name it out_matches
–then use a FOR EACH activity and pass the above variable out_matches and change the type argument as System.Text.RegularExpresions.Match and inside that use a writeline activity and mention as item.ToString.Trim
I have attached a xaml using your four lines that needed string operation. Open the project and run it i am sure you will have a solution - output panel will show the split string results. Open and run the ‘Main’ file xaml only, refer ‘new text Document’ for your strings.