yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

functions in string.i - s

 
 
 
scalar


             scalar -- get optional scalar parameter  
 
    
  PROTOTYPE  
    x = scalar(xarg, xdef, lt=, le=, gt=, ge=, type=, arg=, fn=);  
    
  ARGUMENTS  
    XARG    argument passed to the function.  
    XDEF    default value for the scalar argument (optional, if not  
            specified, then it is guessed that the caller must supply the  
            argument).  
  KEYWORDS  
    GE=     to be valid, XARG must be >= GE (optional, only one of GT or GE  
            can be used).  
    GT=     to be valid, XARG must be >  GT (optional, only one of GT or GE  
            can be used).  
    LE=     to be valid, XARG must be <= LE (optional, only one of LT or LE  
            can be used).  
    LT=     to be valid, XARG must be <  LT (optional, only one of LT or LE  
            can be used).  
    TYPE=   data type of the scalar (optional).  
    FN=     function name for error messages (optional string).  
    ARG=    argument name for error messages (optional string).  
    
  DESCRIPTION  
    Check XARG and return a scalar value (i.e., either XARG converted to TYPE  
    if it is not void or XDEF otherwise).  If XARG is not within any specified  
    bound or if it is not a scalar or if it is void (e.g., not specified) and  
    there is no default value XDEF, an error message is written out.  
    
  EXAMPLE  
    The following function has 2 scalar arguments X and Y, the 1st one is an  
    integer (of type long) which must be specified and be strictly greater  
    than 22 while the 2nd default to .5 and must be in [0., 1.]:  
      func foo(x,y) {  
          x= scalar(x,     gt=22,        type=long,   fn="foo", arg="X");  
          y= scalar(y, .5, ge=0., le=1., type=double, fn="foo", arg="Y");  
          ...  
      }  
    
  WARNING  
    There is no checking of consistency of options.  
    
  HISTORY: 29 Sept. 1995 by Eric THIEBAUT.  (Modified slightly by DHM)  
interpreted function, defined at i/string.i   line 240  
 
 
 
strchr


             strchr -- get first/last index of a character in a string   
 
    
  SYNOPSIS: i = strchr(s, c)  
            i = strchr(s, c, last=1)  
    
  DIAGNOSTIC: returns 0 if character C is not found in string S.  
    
  HISTORY: October 27, 1995 by Eric THIEBAUT.  
    
interpreted function, defined at i/string.i   line 155  
SEE ALSO: strmatch  
 
 
 
strtolower


             strtolower -- convert a string to lower case letters  
 
    
  SYNOPSIS: s2 = strtolower(s)  
    
  HISTORY: October 10, 1995 by Eric THIEBAUT.  
    
interpreted function, defined at i/string.i   line 90  
SEE ALSO: strtoupper  
 
 
 
strtoupper


             strtoupper -- convert a string to upper case letters  
 
    
  SYNOPSIS: s2 = strtoupper(s)  
    
  HISTORY: October 10, 1995 by Eric THIEBAUT.  
    
interpreted function, defined at i/string.i   line 76  
SEE ALSO: strtolower  
 
 
 
strtrim


             strtrim(string)  
          or strtrim(string, which)  
          or strtrim(string, which, blank=blank)  
 
   returns STRING without leading and/or trailing blanks.  If STRING is  
   only made of blanks, return "".  If STRING is 0x0, return 0x0.  
   If WHICH is 1, trim leading blanks (least expensive).  If WHICH is 2,  
   trim trailing blanks (a more costly operation).  If WHICH is 3, (the  
   default) trim both leading and trailing blanks.  
   If STRING is an array of strings, result has same dimensions.  
   The BLANK keyword is a string constituted by characters considered  
   as blanks; by default, BLANK is " \t\n" meaning that spaces,  
   tabs, and newlines are discarded.  
   In the BLANK string, "^", "]", and "-" are treated specially:  
   "]" and "-", if present, should come first in the list to avoid  
   special treatment, while "^" should not come first.  
interpreted function, defined at i/string.i   line 114