How to split characters

Hello everybody
I have data in excel file like this: TS_20180821_apbassln, TS_10180771_apdesignopts, I want to split characters and numbers to be like this apbassln,apdesignopts(starts from the 13th character)
Could you help me with this and thanks a lot

1 Like

Use the data in a variable…let’s say variable1.
variable1.Tostring.Split(Convert.ToChar("_")) . This will split the string and store the result in an Array…let’s call it resultArray.

Use resultArray(2) to print your desired string.

Thanks for your comment and how to split the .xlsx at the end of the record ??

Hi
Kindly follow the below steps that could help you resolve this
Fine
–use a assign activity like this
if in_text a variable of type string has the value "TS_20180821_apbassln.xlsx"
Then
out_file_name = Split(in_text,"_")(2).ToString //output will be apbassin.xlsx
and if the in_text has the value like this “TS_20180821_apbassln.xlsx”
then
out_file_name = Split(Split(in_text,"_")(2).ToString),".")(0).ToString //output will be "apbassln"

or

out_file_name = Split(Split(in_text,"_")(2).ToString),".")(1).ToString //output will be ".xlsx"

Cheers Buddy @marwan992

Split(Split(var,"_")(2).ToString),".")(1).ToString
I am facing problem that : encountered processing expression ?!

There is excess ot close brackets buddy
Sorry that was a typo mistake
It should be like this
Split(Split(var,"_")(2).ToString,".")(1).ToString
Cheers @marwan992

2 Likes

Did that work buddy
Cheers @marwan992

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.