Jump to content

Recommended Posts

Posted

I know there is a simple answer to my question but I just can't find it. I have a string, "123456789" but because there are no delimiters, I can't split the string. I need each number in the string to be put into an array. I know there is an easy way to do this. Thanks for your help.

Posted

$array = StringSplit('123456789', '')
Oh. I didn't know you could split it like that. I thought you had to split it using a character. Thanks!
Posted

I know there is a simple answer to my question but I just can't find it. I have a string, "123456789" but because there are no delimiters, I can't split the string. I need each number in the string to be put into an array. I know there is an easy way to do this. Thanks for your help.

#include <Array.au3>

$STRING = "123456789"
Dim $ARRAY[StringLen($STRING)+1]
$ARRAY[0] = StringLen($STRING)  ;length of the string
For $INDEX = 1 To StringLen($STRING)
    $ARRAY[$INDEX] = StringMid($STRING,$INDEX,1)
Next

_ArrayDisplay($ARRAY)
Posted

Oh. I didn't know you could split it like that. I thought you had to split it using a character. Thanks!

You should consider adding 2 as the third parameter. It removes that retarded $Array[0] element that stores how many elements there are in the array.

Broken link? PM me and I'll send you the file!

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
×
×
  • Create New...