GNU Info

Info Node: (libc.info)String and Array Utilities

(libc.info)String and Array Utilities


Next: Character Set Handling Prev: Character Handling Up: Top
Enter node , (file) or (file)node

String and Array Utilities
**************************

   Operations on strings (or arrays of characters) are an important
part of many programs.  The GNU C library provides an extensive set of
string utility functions, including functions for copying,
concatenating, comparing, and searching strings.  Many of these
functions can also operate on arbitrary regions of storage; for
example, the `memcpy' function can be used to copy the contents of any
kind of array.

   It's fairly common for beginning C programmers to "reinvent the
wheel" by duplicating this functionality in their own code, but it pays
to become familiar with the library functions and to make use of them,
since this offers benefits in maintenance, efficiency, and portability.

   For instance, you could easily compare one string to another in two
lines of C code, but if you use the built-in `strcmp' function, you're
less likely to make a mistake.  And, since these library functions are
typically highly optimized, your program may run faster too.

Representation of Strings
Introduction to basic concepts.
String/Array Conventions
Whether to use a string function or an
arbitrary array function.
String Length
Determining the length of a string.
Copying and Concatenation
Functions to copy the contents of strings
and arrays.
String/Array Comparison
Functions for byte-wise and character-wise
comparison.
Collation Functions
Functions for collating strings.
Search Functions
Searching for a specific element or substring.
Finding Tokens in a String
Splitting a string into tokens by looking
for delimiters.
strfry
Function for flash-cooking a string.
Trivial Encryption
Obscuring data.
Encode Binary Data
Encoding and Decoding of Binary Data.
Argz and Envz Vectors
Null-separated string vectors.

automatically generated by info2www version 1.2.2.9