String Operations

┌─────────────────────────┬──────────────┬─────────────────────────┬───────────┐
│ Function │ Header File │ Link to Function │ Descriptio│
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcat │ "string.h" │ strcat │ Concat- │
│ │ │ │ enates │
│ │ │ │ two │
│ │ │ │ strings. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strchr │ "string.h" │ strchr │ Locates │
│ │ │ │ the first │
│ │ │ │ occur- │
│ │ │ │ rence of │
│ │ │ │ a speci- │
│ │ │ │ fied │
│ │ │ │ character │
│ │ │ │ in a │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcmp │ "string.h" │ strcmp │ Compares │
│ │ │ │ the value │
│ │ │ │ of two │
│ │ │ │ strings. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcmpi │ "string.h" │ strcmpi │ Compares │
│ │ │ │ two │
│ │ │ │ strings │
│ │ │ │ without │
│ │ │ │ sensi- │
│ │ │ │ tivity to │
│ │ │ │ case. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcoll │ "string.h" │ strcoll │ Compares │
│ │ │ │ two │
│ │ │ │ strings │
│ │ │ │ based on │
│ │ │ │ the col- │
│ │ │ │ lating │
│ │ │ │ elements │
│ │ │ │ for the │
│ │ │ │ current │
│ │ │ │ locale. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcpy │ "string.h" │ strcpy │ Copies │
│ │ │ │ one │
│ │ │ │ string │
│ │ │ │ into │
│ │ │ │ another. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strcspn │ "string.h" │ strcspn │ Finds the │
│ │ │ │ length of │
│ │ │ │ the first │
│ │ │ │ substring │
│ │ │ │ in a │
│ │ │ │ string of │
│ │ │ │ charac- │
│ │ │ │ ters not │
│ │ │ │ in a │
│ │ │ │ second │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strdup │ "string.h" │ strdup │ Reserves │
│ │ │ │ storage │
│ │ │ │ space for │
│ │ │ │ the copy │
│ │ │ │ of a │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ stricmp │ "string.h" │ stricmp │ Compares │
│ │ │ │ two │
│ │ │ │ strings │
│ │ │ │ without │
│ │ │ │ sensi- │
│ │ │ │ tivity to │
│ │ │ │ case. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strlen │ "string.h" │ strlen │ Calcu- │
│ │ │ │ lates the │
│ │ │ │ length of │
│ │ │ │ a string. │
└─────────────────────────┴──────────────┴─────────────────────────┴───────────┘
┌─────────────────────────┬──────────────┬─────────────────────────┬───────────┐
│ strncat │ "string.h" │ strncat │ Adds a │
│ │ │ │ specified │
│ │ │ │ length of │
│ │ │ │ one │
│ │ │ │ string to │
│ │ │ │ another │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strncmp │ "string.h" │ strncmp │ Compares │
│ │ │ │ two │
│ │ │ │ strings │
│ │ │ │ up to a │
│ │ │ │ specified │
│ │ │ │ length. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strncpy │ "string.h" │ strncpy │ Copies a │
│ │ │ │ specified │
│ │ │ │ length of │
│ │ │ │ one │
│ │ │ │ string │
│ │ │ │ into │
│ │ │ │ another. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strnicmp │ "string.h" │ strnicmp │ Compares │
│ │ │ │ two │
│ │ │ │ strings │
│ │ │ │ up to a │
│ │ │ │ specified │
│ │ │ │ length, │
│ │ │ │ without │
│ │ │ │ sensi- │
│ │ │ │ tivity to │
│ │ │ │ case. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strnset │ "string.h" │ strnset - strset │ Sets all │
│ │ │ │ charac- │
│ │ │ │ ters in a │
│ │ │ │ specified │
│ │ │ │ length of │
│ │ │ │ string to │
│ │ │ │ a speci- │
│ │ │ │ fied │
│ │ │ │ char- │
│ │ │ │ acter. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strpbrk │ "string.h" │ strpbrk │ Locates │
│ │ │ │ specified │
│ │ │ │ charac- │
│ │ │ │ ters in a │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strrchr │ "string.h" │ strrchr │ Locates │
│ │ │ │ the last │
│ │ │ │ occur- │
│ │ │ │ rence of │
│ │ │ │ a char- │
│ │ │ │ acter │
│ │ │ │ within a │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strrev │ "string.h" │ strrev │ Reverses │
│ │ │ │ the order │
│ │ │ │ of char- │
│ │ │ │ acters in │
│ │ │ │ a string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strset │ "string.h" │ strnset - strset │ Sets all │
│ │ │ │ charac- │
│ │ │ │ ters in a │
│ │ │ │ string to │
│ │ │ │ a speci- │
│ │ │ │ fied │
│ │ │ │ char- │
│ │ │ │ acter. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strspn │ "string.h" │ strspn │ Locates │
│ │ │ │ the first │
│ │ │ │ character │
│ │ │ │ in a │
│ │ │ │ string │
│ │ │ │ that is │
│ │ │ │ not part │
│ │ │ │ of speci- │
│ │ │ │ fied set │
│ │ │ │ of char- │
│ │ │ │ acters. │
└─────────────────────────┴──────────────┴─────────────────────────┴───────────┘
┌─────────────────────────┬──────────────┬─────────────────────────┬───────────┐
│ strstr │ "string.h" │ strstr │ Locates │
│ │ │ │ the first │
│ │ │ │ occur- │
│ │ │ │ rence of │
│ │ │ │ a string │
│ │ │ │ in │
│ │ │ │ another │
│ │ │ │ string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strtok │ "string.h" │ strtok │ Locates a │
│ │ │ │ specified │
│ │ │ │ token in │
│ │ │ │ a string. │
├─────────────────────────┼──────────────┼─────────────────────────┼───────────┤
│ strxfrm │ "string.h" │ strxfrm │ Trans- │
│ │ │ │ forms │
│ │ │ │ strings │
│ │ │ │ according │
│ │ │ │ to │
│ │ │ │ locale. │
└─────────────────────────┴──────────────┴─────────────────────────┴───────────┘


[Back: String and Character Collating]
[Next: Character Testing]