danny0 Posted January 4, 2009 Share 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. Link to comment Share on other sites More sharing options...
Achilles Posted January 4, 2009 Share 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] Link to comment Share on other sites More sharing options...
danny0 Posted January 4, 2009 Author Share 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! Link to comment Share on other sites More sharing options...
Andreik Posted January 4, 2009 Share 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) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Andreik Posted January 4, 2009 Share 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. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
clarinetmeister Posted January 4, 2009 Share Posted January 4, 2009 CODELocal $array[stringLen($string)+1] For $a = 1 to StringLen($string) $array[$a] = StringMid ($string, $a, 1) Next Link to comment Share on other sites More sharing options...
monoceres Posted January 4, 2009 Share 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! Link to comment Share on other sites More sharing options...
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