The wasChgWord
function changes a word by index in sequence of token-delimited words and returns the resulting sequence.
For example:
Say wasChgWord('Search/For/Me', 3, 'Food', '/')
will output: Search/For/Food
/*************************************************************************/ /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ /*************************************************************************/ wasChgWord: procedure /* Change a word in a token delimited string. */ Parse ARG String,Index,Replace,Token If String = '' Then Return '' Parse VAR String Head Interpret(Token) Tail Look = wasChgWord(Tail,Index - 1,Replace,Token) If Index = 1 Then Head = Replace If Look ~= '' Then Return Head || Token || Look Return Head