About

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

Code

/*************************************************************************/
/*    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: 2017/02/22 18:30 (external edit)

Access website using Tor Access website using i2p


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