4

Maybe I'm just not very good with Google, but I'm looking for good terms to use when describing manipulation of strings of characters, specifically words to describe:

  • Removing a prefix
  • Removing a suffix
  • Removing an infix, i.e. taking out some middle part and concatenating the remaining parts

    A more or less comprehensive list of string manipulation terminology would be nice, but just providing the above definitions would suffice.

1 Answer 1

3

If you look at various string-manipulation libraries, tools, and programming languages, you will see a variety of different verbs used here, most of which are general and not location specific.

  • remove — anywhere
  • delete — anywhere
  • strip — usually anywhere
  • trim — usually on the two ends only: front/rear or left/right
  • splice — either medial only, or anywhere
  • chop, chomp — the rear end

Since there is little consensus here, you should probably just be explicit in your language:

s/^string//;      # delete_from_front(), remove_leading()
s/string$//;      # delete_from_end(), remove_trailing()
s/string//g;      # delete_all(), remove_all()
2
  • I think I've also seen lop for cutting off an end but don't have a reference Nov 30, 2012 at 17:09
  • I think there's usually a difference between "strip off" and "strip out" (of course, "off" or "out" may be implied in a method/function name, which may lead to confusion). Nov 30, 2012 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.