Reading data from text file based on delimiter

studio
variable
string

#1

database:TEST
path:“C:\Users\soma.ponnuru\Documents\UiPath”

I have a data like that in a text file and by reading the text file it should split based on colon delimiter.

I want the output ““C:\Users\soma.ponnuru\Documents\UiPath”” to be stored in a variable.

please help me.


#2

Hi @somas1218,

In that case try this :slight_smile:

1.> Store the String “C:\Users\soma.ponnuru\Documents\UiPath” in a variable. for example - Test_String

2.> Use Assign Activity and there are two fields

To Part - String_Array Note - String_Array is a variable of type System.String[]

Value part - Test_String.ToString.Split({":"},StringSplitOptions.None)

Use msg boc activity and type String_Array(0) will display : "C"

and String_Array(1) will display " \Users\soma.ponnuru\Documents\UiPath "


#3

Please help me


#4

Thanks for the reply.

database:TEST
path:“C:\Users\soma.ponnuru\Documents\UiPath”

My problem is Thae above lines are present in text file.I’m reading the file using read text file.
From that text file i want to get the output as “C:\Users\soma.ponnuru\Documents\UiPath”


#5

Hi,

Try to split output of text file using “path:”.

Assign a variable with value of the first index of array output. ex: arrayData(1)

Regards,
Rahamat