Instr(). Please help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
oldbrother
Posts: 273
Joined: 23 Oct 2013, 05:08

Instr(). Please help

29 Nov 2021, 13:42

The first Pos is supposed to be 7, but I always get 4. Why? StartingPOS seems not working.

Code: Select all


Txt := "123.123456"
Pos := InStr(Txt, "." , false , -1)
msgbox %Pos%  ; returns 4

Pos := InStr(Txt, "." , false , 1)
msgbox %Pos%  ; returns 4 too. 

User avatar
mikeyww
Posts: 26934
Joined: 09 Sep 2014, 18:38

Re: Instr(). Please help

29 Nov 2021, 13:48

StartingPos reflects the number of places to ignore.
Regardless of the value of StartingPos, the return value is always relative to the first character of Haystack.
User avatar
oldbrother
Posts: 273
Joined: 23 Oct 2013, 05:08

Re: Instr(). Please help

29 Nov 2021, 13:56

Hi mikeyww,

Thank you very much for your quick reply. I didn't understand it correctly. :headwall: :headwall: :headwall:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1, ReyAHK, Rohwedder and 301 guests