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