vb.net - splitting a string into multiple variables -
I'm trying to split a string into several variables into the data in my string of spaces There is separate data from a different (random) number.
"Mike Smith 123 23 33 2 1" I've tried string.split method though I'm having trouble handling numerical data . String dim strFirstName, as strLastName, str_devil intAvg, intHcp, intTotalPins, intGamesTracked as integer strUserInfo = lstUsers.SelectedItem string strider (), as the slow strUserInfo. Strarr = strUserInfo.Split ("." C) as strings strFirstName = strarr (0) strLastName = strarr (1)
If you do not know how many locations are between each section, you would want to use this surcharge, such as:
strarr = strUserInfo.split ( New Variable () {""}, String Split Option. RemoveEmptyEntries) And when you want to store in a integer variable, ): strFirstName = strarr (0) strLastN intevg = CIn (strarr (2)) intHcp = CInt (strarr (3)) intTotalPins = CInt (strarr (4)) intGamesTracked = CInt (strarr (5))
Comments
Post a Comment