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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -