Strings

There's a pair of string functions that I first wrote back in 1979 when I learned Basic on a Commodore 4K PET. I wrote them because I found Basic's string handling functions, which are just numeric indices into the string as an array of characters, very tedious to use. My functions instead use a string pattern to split strings. I've since written them in every language I've learned, including Forth, Pascal, Ruby and Python. 

I call them before() and after() and they do exactly what they say: before(“pterodactyl”,”rod”) returns “pte”, whereas after(“pterodactyl”,”rod”) returns “actyl”’. Python of course provides a string method split() to do the same job – "pterodactyl".split("rod")[1] returns ”actyl”  – but I’m now so attached to my before and after that I still prefer to use them most of the time: