Back to library index.
Package string (in string.i) -
Index of documented functions or symbols:
DOCUMENT 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)
DOCUMENT 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.
DHM modified for yorick-1.6 23/Jan/05
********** DEPRECATED **************
new code should use strfind directly
SEE ALSO: strmatch
DOCUMENT strtolower -- convert a string to lower case letters ********** DEPRECATED ************** new code should use strcase directly
SEE ALSO: strtoupper
DOCUMENT strtoupper -- convert a string to upper case letters ********** DEPRECATED ************** new code should use strcase directly
SEE ALSO: strtolower
