Split Synatx error

Hello Guys, I am getting below error

Can anyone help, where I am getting wrong

Hello @NikhilRPA

What is the data type of the variable text? It should be of type string.

Change that and see whether this works.

You can also try this way

Text.Split(" "c)

Hi,

String.Split method returns string array, so text = text.split(CChar(" ")) is wrong sentence
You need to write like the following.

stringArrayVar = stringVar.Split.split(CChar(" "))
or
text = text.Split.split(CChar(" "))(0)
(text should be String type)

Regards,

Can we see the value that you wanted to split. ? @NikhilRPA

By the way for your reference kindly see the article below.

cheers :smiley:

Happy learning :smiley:

@Lahiru.Fernando Hi, The datatype for the variable text is Array(String)

I am getting same error if I use the syntax you told

@pattyricarte I wanted to split the word “City Hyderabad”

Hi @NikhilRPA

Use this StringVariable.split(" "c) and pass it to array and you will get the value using index 0 and 1 :smiley:

As i can see to your respond to @Lahiru.Fernando the data type of th string is array.

So no need for you to split it ryt.You just need to use the index in the array of use for each to get the value.

cheers :smiley:

Happy learning :smiley:

@Yoichi- Hey but in the video of tutorial about split, it work’s fine with same syntax i posted

@pattyricarte- If you see the above screen shot I posted with error using the same syntax text.split(" "c)

Yah i saw it i edit my post.Just use foreach for it and you will get the value or index @NikhilRPA

cheers :smiley:

Happy learning

No I just want to spilt the words by using space as delimeter and send that split values into array variable and display using for each

Text= text.split(" ",c)

But as you mentioned it was an array of string so my perception no need to split it.Because when you use the text.split it will create an array of string.!

you just need to text(0).ToString or text(1).ToString to get the value or you can use Foreach to iterate in the array of string and easily get the value.

cheers :smiley:

Happy learning :smiley:

Got you thanks @pattyricarte

No worries @NikhilRPA

Happy to help here :smiley:

cheers :smiley:

Happy learning :smiley: