Using the Autohotkey StringSplit / StrSplit() function to slice strings

autohotkey StringSplitAutoHotkey Merchandise-White Stress ballUsing the AutoHotkey StringSplit / StrSplit() function

AutoHotkey has some pretty cool functions for slicing strings. Not quite as robust as Python however they definitely cover the majority of needs with ease.  In the below video I demonstrate some simple usage if it as well as a way to access the Array it creates without ever saving it to a variable!  🙂

 
Browser_Forward::Reload
Browser_Back::
str:="my example string"
s:=StrSplit(str," ") ;Create an Array in "s" parsing on spaces
myVar:= s.1 ;Access the first item in the Array

MsgBox % myVar

Loop, $ s.MaxIndex() ;since it is an array you can get the count of items
    MsgBox % s[A_index] ;iterate over the items in the array

 

Tutorial demonstrating AutoHotkey StringSplit function

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.