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
Happy learning
@Lahiru.Fernando Hi, The datatype for the variable text is Array(String)
I am getting same error if I use the syntax you told
Hi @NikhilRPA
Use this StringVariable.split(" "c) and pass it to array and you will get the value using index 0 and 1
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
Happy learning
@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
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
Happy learning
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.