StrSplit for AutoHotkey v1.1 (pre-v1.1.13)

Post your working scripts, libraries and tools
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

StrSplit for AutoHotkey v1.1 (pre-v1.1.13)

20 Jul 2019, 05:43

Here's an attempt at StrSplit for AutoHotkey v1.1 (pre-v1.1.13) (minus MaxParts parameter).
It's difficult/impossible to get hold of older versions of AutoHotkey v1.1 for testing purposes.
Not widely tested. Do notify of any issues.

Code: Select all

;StrSplit for AutoHotkey v1.1 (pre-v1.1.13) (minus MaxParts parameter)
StrSplitBackport(vText, vDelim:="", vOmitChars:="")
{
	if IsObject(vDelim) || (StrLen(vDelim) > 1)
	{
		vUnused := ""
		Loop 300
		{
			if !InStr(vText, Chr(A_Index))
			{
				vUnused := Chr(A_Index)
				break
			}
		}
		if (vUnused = "")
			throw "no delimiter available"
		if !IsObject(vDelim)
			vText := StrReplace(vText, vDelim, vUnused)
		else
		{
			for _, vDelim in oArray
				vText := StrReplace(vText, vDelim, vUnused)
		}
	}
	else
		vUnused := vDelim
	oArray := []
	Loop Parse, vText, % vUnused
		oArray[A_Index] := Trim(A_LoopField, vOmitChars)
	return oArray
}
StrReplace:
Unicode functions for AutoHotkey Basic / AutoHotkey x32 ANSI - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=32487&p=173620#p173620
Last edited by jeeswg on 20 Jul 2019, 05:53, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Helgef
Posts: 4031
Joined: 17 Jul 2016, 01:02
Contact:

Re: StrSplit for AutoHotkey v1.1 (pre-v1.1.13)

20 Jul 2019, 05:48

StrReplace() [v1.1.21+]
Edit, hi jeeswg :wave:

Edit 2, #cool :thumbup:
Last edited by Helgef on 20 Jul 2019, 05:56, edited 1 time in total.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: StrSplit for AutoHotkey v1.1 (pre-v1.1.13)

20 Jul 2019, 05:53

Look again. #UpdatedPost. Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 81 guests