vb.net - Substring not sub stringing string, or rather, substring not working as it should -


i'm working on application users can select values presented them, have specific form this: userdata_north, userdata_south.

i need part of string after _, tried doing substring this:

dim rightstring = userdatavar.substring(userdatavar.indexof("_"), userdatavar.length) 

which believe gets whatever after _ , until string ends. returns nothing reason. i've gotten wrong?

you've mistaken how substring works. need following:

dim rightstring = userdatavar.substring(userdatavar.indexof("_") + 1)

the reason it's returning nothing because starting halfway through string , asking go entire length of string , going outside range of it.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -