While we are discussing string manipulation perhaps is wise to discuss metasyntactic variable use to get it out of the way.
I started programming in the late 70s, early 80s, and whilst I relegated programing to a “sometimes task” in the early 90’s I have maintained an interest.
- This is relevant to the following.
I only came across the “Foo Bar Baz” this millennium, first I was Quizzical, I wondered if there was more information or depth involved with their use, thinking perhaps it was useful like communications Alice and Bob , the more I learned about the use of “foo bar baz” the more I realised it was a shallow set of place holders containing no information what so ever.
It has only being since conversation’s in TiddlyWiki that I have realised not only is it usually meaningless but when used you will discover it is harder to read code containing “Foo bar baz” than realistic names.
I do recall that sometimes it is hard to come up with variable names and values, examples, metaphors or parallel models both when coding and especially when sharing and teaching code or concepts.
- As a programmer this was a skill I had to learn, and my teachers worked hard to teach us how to do this, in both tangible and intangible ways.
In most specialist areas if something is difficult, you often find people avoiding it rather than learning about it to make it simple. I am not surprised then that people use hollow place holder names and values like Foo Bar Baz, first due to laziness, then due to it being a lazy convention.
So what would/do I do instead
I spend a little more time and creative effort, to try and find common place activities as a metaphor to bring life to my variable names and values, one of the most common is recipies.
- I may share some examples, but I hope you understand the concept.
Not withstanding the above @Scott_Sauyet use above was one of the best uses I have ever seen, in part because it blended plain language with the arbitrary food bar baz output.
Finaly, I think this is directly related to this subject of string handling and substrings,
Give us real world examples of substrings not “oo’s ar’s and az”