Split Array


#1

Hi,

Am trying to get item[0]. Am getting end of expression expected error!
Please help!


#2

try round brackets item(0) instead of square


#3

you can only access like with small brackets e.g. item(0).tostring()


#4

I tried it! getting this error


#5

check item typearguement, should be string and you don’t need to specify index, just item.tostring

or splitData(1).ToString


#6

Type argument should be string and then use item in writeline instead of item(0) otherwise you will get first character.


#7

Hi both thank you for your suggestions!

However i want to extract the highlighted data in the attached documents from splitData.


#8

I would try below way.

splitData = Split(pdfdata, Environmet.Newline)

strName = splitData(3).ToString() // if you know the position

#9

Don’t know if this was answered yet, but seems to me that you are splitting the data into an array, then going through each item.

You will want to leave off the brackets.

item.ToString

You can leave off the brackets because the For Each is going through each individual item in the array. You would only use the brackets if you are accessing another array or dataRow of sorts.