Page 1 of 1
Size of array after stringsplit
Posted: 04 Apr 2019, 02:28
by paik1002
How do get the size of the array after stringsplit?
Code: Select all
StringSplit,myArray,Clipboard,`n,`r
msgbox % myArray.MaxIndex() ; size of myArray
Re: Size of array after stringsplit Topic is solved
Posted: 04 Apr 2019, 02:44
by Helgef
Re: Size of array after stringsplit
Posted: 04 Apr 2019, 03:02
by paik1002
Thanks you and it works!
Re: Size of array after stringsplit
Posted: 04 Apr 2019, 10:25
by sinkfaze
Just for clarity's sake:
StringSplit - OutputArray wrote:
The name of the pseudo-array in which to store each substring extracted from InputVar. For example, if MyArray is specified, the command will put the number of substrings produced (0 if none) into MyArray0, the first substring into MyArray1, the second into MyArray2, and so on.
Code: Select all
StringSplit,myArray,Clipboard,`n,`r
msgbox % myArray0 ; size of myArray
But as helgef has already noted:
StringSplit wrote:
Deprecated: This command is not recommended for use in new scripts. Use the StrSplit function instead.
Re: Size of array after stringsplit
Posted: 08 Apr 2019, 03:43
by kiwichick
Hi Helgef, I don't know what I'm doing wrong but I can't get StrSplit to work.
I try this:
Code: Select all
myArray := StrSplit(Clipboard, `n,`r)
but I get the "variable name contains an illegal character" error.
Re: Size of array after stringsplit
Posted: 08 Apr 2019, 04:07
by Odlanir
Code: Select all
myArray := StrSplit(Text, "`n","`r")
Re: Size of array after stringsplit
Posted: 08 Apr 2019, 07:52
by SOTE
It's probably best to clarify how myArray will look different, if you use StrSplit (real array) or StringSplit (pseudo array).
StrSplit: myArray[1], myArray[2], etc...
StringSplit: myArray1, myArray2, etc...