danny0 Posted January 4, 2009 Posted January 4, 2009 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.
Achilles Posted January 4, 2009 Posted January 4, 2009 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.$array = StringSplit('123456789', '') My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
danny0 Posted January 4, 2009 Author Posted January 4, 2009 $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!
Andreik Posted January 4, 2009 Posted January 4, 2009 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)
Andreik Posted January 4, 2009 Posted January 4, 2009 Oh. I didn't know you could split it like that. I thought you had to split it using a character. Thanks!It works. It's more good then my example.
clarinetmeister Posted January 4, 2009 Posted January 4, 2009 CODELocal $array[stringLen($string)+1] For $a = 1 to StringLen($string) $array[$a] = StringMid ($string, $a, 1) Next
monoceres Posted January 4, 2009 Posted January 4, 2009 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!
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