![]() |
Forum Index : Microcontroller and PC projects : Position of a substring
Author | Message | ||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
I want to find the position of a substring (say 'a') in a string (say 'Marvel'). Need to find the MMBasic syntax for INSTR or POS or something like that. Syntax like: Position = ("Marvel","a"), so that position here yields 2. Or even starting the search from some other place than the start of the string, something like Position = (String, Start, Instring) Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
Page 75 of the manual. [Quote]INSTR( [start-position,] stringsearched$, string-pattern$ ) Returns the position at which 'string-pattern$' occurs in 'string-searched$', beginning at 'start-position'. Both the position returned and 'start-position' use 1 for the first character, 2 for the second, etc. The function returns zero if 'string-pattern$' is not found. [/quote] The Manual can be found here Cheers |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Many thanks. Just what I wanted. Couldn't find it in my manual (must be way out of date)... Or else I am! Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |