Jump to content

Recommended Posts

Posted (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 0

Number($data[13]) returns 0

That's a problem... Ideas in how to preserve existing strings?

Edited by ozone
Posted

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 0

Number($data[13]) returns 0

That'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])

Posted

Use the function StringIsDigit

Here 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...