The wasFindWord function finds a word within a sequence of token-delimited words and returns its index in the sequence.

For example:

Say wasFindWord('Search/For/Me', 'Me', '/')

will output: 3


/*    Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3    */
wasFindWord: procedure /* Find the index of word in a string by token.  */
    Parse ARG String,Word,Token,Index
    If String = '' Then Return 0
    If Index = '' Then Index = 1
    Parse VAR String Head Interpret(Token) Tail
    If Head ~= Word Then Return wasFindWord(Tail,Word,Token,Index+1)
Return Index

fuss/amiga/arexx/token_delimited_words/findword.txt ยท Last modified: 2022/04/19 09:28 (external edit)

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key

For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy, copyright and the plagiarism pages.