IMPORT WITH:
#import "string"
The routines in this packagage are statically compiled into the
prog_unit, but become available only after the above directive
is given.
EXPORTED FUNCTIONS:
Most of the functions below are modelled after their counterparts
with the same name in the C-standard library. Note that the
prog_unit allows to use both float or char* arrays to hold strings
(these are fully interchangeable as arguments).
- strcmp(char *s1, char *s2)
- compare two strings and return
-1, 0 (if s1 and s2 are equal) or +1.
- strncmp(char *s1, char *s2, float len)
- compare maximally
first len characters of s1 and s2
- int strspn(char *s1, char *s2)
- length of initial segment
of s1 consisting entirely of characters from s2.
- int strcspn(char *s1, char *s2)
- length of initial segment
of s1 consisting entirely of characters not from s2.
- strcpy(float *to, char *from)
- copy string from into array to.
If the dimension of to is insufficient, the copy may be truncated.
No char* return value that can be used as a handle to to!
- strncpy(float *to, char *from, float len):
- as before, but
copy is limited to at most len chars.
- memove(float *to, float *from, float num)
- copy num elements
from from to to.
- memmove(int *to, int *from, float num)
- the same, but for
int arrays (overloaded function).
- memset(float *to, float value, float num)
- fill num first
elements of array to with value value.
- memcpy(float *to, float *from, int num)
-
- memcpy(int tostride, float *to, float *from, int num)
-
- memcpy(float *to, int fromstride, float *from, int num)
-
- memcpy(int tostride, float *to, int fromstride, float *from, int num)
-
similar to memove, but permits additional specification of strides between
copied locations in destination and/or source array. If num is too large,
the number of actually copied elements gets limited by the available
elements and the available space.
- strcat(float *s1, char *s2)
- append s2 to s1.
- strstr(float *s, char *t)
- return offset, when t is substring
of s, otherwise return -1.
- strchr(float *s, float ch)
- return offset, when ch is character
of s, otherwise return -1.
- strpbrk(char *s1, char *s2)
- return offset of first char of s1
that is in s2, -1 if none.
- char *strtok(char *s, char *delim)
- tokenize string s into
tokens in an analogous way as strtok from stdio:
The first call must be with delim=string of separators to use and
returns the first token. Each subsequent call must be with
delim=NULL (unless a new sequence is to be started) and returns
a further token, or NULL if at end. Unlike stdio strtok, the
prog_unit version returns a newly allocated token copy at each call
and lets s unmodified. NOTE: the routine is not re-entrant, thus, don't
spread a call sequence over several prog_unit invocations (other
prog_units might interfere by accessing strtok too).
- char *strtok(char *s, char *delim, int pos)
- "one-shot-version"
that returns the token at position pos of s, or NULL, if no
such token exists, or entire s, if delim=NULL. Not reentrant.
- char *strtok(char *s, int pos)
- as before,, but with the
default that the separator is any white space.
- strtoken(float *buf, char *s1, char *s2)
- as strtok,
but used a buffer buf to pass each token back. Return value
is length of token, or 0, if at end. Not reentrant.
- atof(char *s), atoi(char s)
- convert string s to float
or int value and return result (0 if s is not numeric).
- strtol(char *s, float *rest, float base)
- convert initial
portion of s into integer, using base base, and return result.
- strtod(char *s, float *rest)
- convert initial portion of
s into float and resturn result.
- toupper(c),tolower(c),isdigit(c)
-
- isalpha(c),isupper(c),islower(c):
-
mimic C functions of the same name (in all cases, c is a float
representing a character)
- getenv(float *to, char *environmentVariableName)
- get environment variable and copy it to string.
Return value R:
R=0: not present;
R=1: empty;
R>1: R = string_length + 1;
R<0: R = required array length, which is here too short
and indicates truncation.
FILE
/local/homes/rhaschke/nst7/man/../o.linx86//../nstsrc/nst_prog_libs.c