ozone Posted November 5, 2004 Posted November 5, 2004 (edited) GOAL = Convert "00,03,01,001,1,0,0,01,00,00,00,0,HELLO" to an array of either numbers or strings.$data = StringSplit("00,03,01,001,1,0,0,01,00,00,00,0,HELLO", ",")But here is the problem.Number($data[1]) returns 0Number($data[13]) returns 0That's a problem... Ideas in how to preserve existing strings? Edited November 5, 2004 by ozone
ozone Posted November 5, 2004 Author Posted November 5, 2004 GOAL = Convert "00,03,01,001,1,0,0,01,00,00,00,0,HELLO" to an array of either numbers or strings.$data = StringSplit("00,03,01,001,1,0,0,01,00,00,00,0,HELLO", ",")But here is the problem.Number($data[1]) returns 0Number($data[13]) returns 0That's a problem... Ideas in how to preserve existing strings?<{POST_SNAPBACK}>Ahh, maybe I'm just having a slow day haha. The solution would be:If StringIsAlNum($data[1])=1 Then $data[1]=Number($data[1])
SlimShady Posted November 5, 2004 Posted November 5, 2004 Use the function StringIsDigitHere is the final result:$data = StringSplit("00,03,01,001,1,0,0,01,00,00,00,0,HELLO", ",") For $i = 1 To $date[0] If StringIsDigit($data[$i]) Then $data[$i] = Number($data[$i]) Next
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now