sh-string man page on Inferno

Man page or keyword search:  
man Server   579 pages
apropos Keyword Search (all sections)
Output format
Inferno logo
[printable version]

SH-STRING(1)							  SH-STRING(1)

NAME
       prefix,	in, splitl, splitr, drop, take, splitstrl, splitstrr, tolower,
       toupper, len, alen, slice - shell script string manipulation

SYNOPSIS
       load string

       prefix pre s
       in c cl
       ${splitl s cl}
       ${splitr s cl}
       ${splitstrl s t}
       ${splitstrr s t}
       ${take s cl}
       ${tolower s}
       ${toupper s}
       ${len s}
       ${alen s}
       ${slice start end s}
       ${fields cl s}
       ${padl n [ s...	]}
       ${padr n [ s...	]}

DESCRIPTION
       String is a loadable module for	sh(1)  that  provides  a  shell-script
       interface  to the string manipulation commands found in string(2), with
       a couple of other facilities thrown in for good measure.	 Each  of  the
       substitution builtins splitl, splitr, drop, take, splitstrl, splitstrr,
       tolower, and toupper implements the same functionality as that provided
       by the function of the same name in string(2).  Where a function in the
       string(2) module returns a tuple, the equivalent builtin yields a  two-
       element list; the others yield a list with a single element.

       In  all	string	commands,  the	number	of  arguments provided must be
       exactly that required by the command so, for instance, giving an	 unde‐
       fined  variable (a zero element list) as an argument will cause a usage
       exception to be generated.

       The two builtins prefix and in are again	 similar  to  their  string(2)
       counterparts  -	their  return  value  is true (an empty string) if the
       equivalent string(2) function would be non-zero.

       Len returns the length of its argument s.  Alen returns the  length  of
       its  argument s when converted to a byte-array. (This will be different
       from the result of len when s contains non-ASCII characters).  Slice is
       similar to the string-slicing operator in Limbo; it returns the section
       of s starting at index start and ending just before index end.  End may
       be  the	literal string end, in which ${slice start end} is the same as
       ${slice start ${len s}}.	 Unlike in Limbo, nothing untoward happens  if
       an out-of-range slice is taken: any out of range indices are trimmed to
       within the bounds of s.

       Fields is similar to ${split} in sh(1), but does not merge field	 sepa‐
       rator  characters.   It splits s into fields separated by characters in
       class cl; if there are n characters matching cl inside s,  fields  will
       yield n+1 items in its result.

       Padl  and padr widen the string s to n characters, padding it with spa‐
       ces on the right (for padl) or the left (for padr) as necessary.	 If  s
       is  already  at least n characters wide, it is left unchanged.  If sev‐
       eral arguments are given, they are concatenated, separated with spaces,
       before padding takes place.

SOURCE
       /appl/cmd/sh/string.b

SEE ALSO
       string(2), sh(1), sh-std(1), sh-expr(1)

								  SH-STRING(1)
[top]

List of man pages available for Inferno

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net