Split variable

please I want to split from variable like this the name of the file is Rabeaalhaj _1234_basic.pdf here I want to put the name in one variable and the ID in another variable and the word basic in variable also so please how can I spilt them

hi @rabea_alhaj,
use the below code to split the value.
strVariable ='Rabeaalhaj _1234_basic.pdf '
arrayvariable=strVariable.ToString().Split("_"c)
Name=arrayvariable(0)
ID=arrayvariable(1)
basic=arrayvariable(2).Replace(".pdf","")

Regards,
Arivu

1 Like

@rabea_alhaj, Make changes in arivu’s code,

Split("_"c)

Regards,
Dominic :slight_smile:

thank you so much for your replay but this not work the names of files already inside this variable SelectFile when I make the variable inside write line I show me the full name of the list of files as
Benemen Finland OY_2850__Basic.pdf I did like you said but did not work maybe I have to change the variable type I did it but still give me error

Hi @rabea_alhaj,
what exception you are getting???

THank you so much finally worked but the last one arrayvariable(2).Replace(".pdf","") give me an error

what error you are facing?
try to use below one

arrayvariable(2).ToString().Replace(".pdf","")

Regards,
Arivu

1 Like

yes it is working now but when I but it in write line all are returns good this one arrayvariable(2).ToString().Replace(".pdf","") return empty it should return basic