How to split character

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

@marwan992 , If this is your string , then you can do that as string.split("_"c).Last() …

You will get this … apbassln

Use this variable=String.Split({"_"c}) then Variable(2).ToString
It will fetch the last name.

TS_20180821_apbassln.xlsx
this is the whole record and i want only: apbassln

Hi @marwan992,

If the file name format remains the same, the you can use Split function.

text=Split(Split(“TS_10180771_apdesignopts”,"_")(2),".")(0)

This will give you only “apdesignopts” without “.xlsx”

BR
Devbrath Rajkhua

no it is dynamic not static

Even if the file format remains dynamic but has a structure like this ab_12345678_abcdefgh.xlsx, the split function will return abcdefgh.

BR
Devbrath Rajkhua

Hi @marwan992

You can use this -
inputString.Split({"_","."},StringSplitOptions.None)
You will get your output

1 Like

@marwan992
Then you have to use another split…

string(string.split("_“c).Last()).split(”."c).First()

Here :

  1. string.split("_"c).Last() --> this will give you the output as apbassln.xlsx
  2. split("."c).First() --> this will split again with “.” and give you apbassln …
2 Likes

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