Trying to do a split but not sure what character to use

I am trying to split a string by : and a tab or three or more spaces. The attached PDF is the one I am working with form my POC. Everything seems to work until I get to test6 test7 and test8. I am trying to figure out what to use to split where the tabs are.

Test Read.pdf (206.0 KB)

string_ScrapedPDF.Split({" “,”:“,vblf,”\t"},StringSplitOptions.None)

Try using \s+ for one or more space characters:

string_ScrapedPDF.Split(“\s+”,StringSplitOptions.None)

1 Like

I figured it out the tab was 4 spaces long instead of 5. I used the following to resolve this.

string_ScrapedPDF.Split({" "," "," "," ",":",vblf,vbTab},StringSplitOptions.None)

I tried it but it did not seem to work. I did add this to my notes for future use though thank you!

@LeftBrainCo - the tab character in vb.net is vbTab - “\t” is the tab character in C# only.

You can just replace the \t with vbtab and it should work fine. You will get a bunch of empty strings in your array using your split as-is though, so you might want to use StringSplitOptions.RemoveEmptyEntries or else revise which strings you are splitting on

2 Likes

The big issue I had is vbTab would not work. for this POC I used quad spaces to fix the problem. I agree in the actual automation I will handle clean up this was just a POC.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.