Search code examples
cstringnaming-conventionsabbreviationstring.h

What do each of the str-function abbreviations/acronyms mean?


The C standard library string.h contains several functions to manipulate strings, all of which start with str and end with an abbreviation. Some of these abbreviations are obvious:

  • strlen string length
  • strcpy string copy
  • strcmp string compare

Some are a bit less straightforward:

  • strpbrk string pointer break?
  • strspn string ...spn?
  • strrchr string ... R char??
  • strxfrm string... um... nevermind.

What do each of the str-function abbreviations/acronyms mean?


Solution

    • strlen - find LENgth of string
    • strcpy - CoPY strings
    • strcmp - CoMPare strings
    • strrchr - Reversely find CHaRacter
    • strspn - calculate the length of SPaN of characters
    • strxfrm - TRANS (written as X)-FoRM a string
    • strpbrk - find the Point where string is BRoKen by any of the characters