Size of array after stringsplit Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
paik1002
Posts: 352
Joined: 28 Nov 2015, 02:45

Size of array after stringsplit

04 Apr 2019, 02:28

How do get the size of the array after stringsplit?

Code: Select all

StringSplit,myArray,Clipboard,`n,`r
msgbox % myArray.MaxIndex()	; size of myArray
paik1002
Posts: 352
Joined: 28 Nov 2015, 02:45

Re: Size of array after stringsplit

04 Apr 2019, 03:02

Thanks you and it works!
User avatar
sinkfaze
Posts: 613
Joined: 01 Oct 2013, 08:01

Re: Size of array after stringsplit

04 Apr 2019, 10:25

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.
kiwichick
Posts: 94
Joined: 21 Jan 2014, 22:03

Re: Size of array after stringsplit

08 Apr 2019, 03:43

Helgef wrote:
04 Apr 2019, 02:44
Use strsplit.
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.
Odlanir
Posts: 514
Joined: 20 Oct 2016, 08:20

Re: Size of array after stringsplit

08 Apr 2019, 04:07

Code: Select all

myArray := StrSplit(Text, "`n","`r")
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
SOTE
Posts: 742
Joined: 15 Jun 2015, 06:21

Re: Size of array after stringsplit

08 Apr 2019, 07:52

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...

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, clarsondd, PENpal, taylope1, tryynoob and 262 guests