manpagez: man pages & more
info gawk
Home | html | info | man

gawk: String Functions

 9.1.3 String-Manipulation Functions
 The functions in this minor node look at or change the text of one or
 more strings.
    'gawk' understands locales (⇒Locales) and does all string
 processing in terms of _characters_, not _bytes_.  This distinction is
 particularly important to understand for locales where one character may
 be represented by multiple bytes.  Thus, for example, 'length()' returns
 the number of characters in a string, and not the number of bytes used
 to represent those characters.  Similarly, 'index()' works with
 character indices, and not byte indices.
      CAUTION: A number of functions deal with indices into strings.  For
      these functions, the first character of a string is at position
      (index) one.  This is different from C and the languages descended
      from it, where the first character is at position zero.  You need
      to remember this when doing index calculations, particularly if you
      are used to C.
    In the following list, optional parameters are enclosed in square
 brackets ([ ]).  Several functions perform string substitution; the full
 discussion is provided in the description of the 'sub()' function, which
 comes toward the end, because the list is presented alphabetically.
    Those functions that are specific to 'gawk' are marked with a pound


© 2000-2018
Individual documents may contain additional copyright information.