Trio
Competitors
Download

SourceForge Logo

strio -- man page

NAME

StrAlloc, StrAppend, StrAppendMax, StrContains, StrCopy, StrCopyMax, StrDuplicate, StrDuplicateMax, StrEqual, StrEqualMax, StrEqualCase, StrEqualCaseMax, StrError, StrFormat, StrFormatMax, StrFormatDateMax, StrFree, StrHash, StrIndex, StrIndexLast, StrLength, StrMatch, StrMatchCase, StrScan, StrSpanFunction, StrSubstring, StrSubstringMax, StrTokenize, StrToDouble, StrToFloat, StrToLong, StrToUnsignedLong, StrToUpper - string functions

SYNOPSIS

cc ... -ltrio -lm

#include <strio.h>

See section Functions below for the prototypes of the string functions.

DESCRIPTION

This package renames, fixes, and extends the C string handling functions.

NAMING

Renaming is done to provide more clear names, to provide a consistant naming and argument policy, and to hide portability issues.

* All functions starts with "Str".

* Target is always the first argument, if present, except where the target is optional, such as StrToDouble().

* Functions requiring a size for target ends with "Max", and the size is always the second argument.

FIXING

Fixing is done to avoid subtle error conditions. For example, strncpy() does not terminate the result with a zero if the source string is bigger than the maximal length, so technically the result is not a C string anymore. StrCopyMax() makes sure that the result is zero terminated.

EXTENDING

Extending is done to provide a richer set of fundamental functions. This includes wildcard matching (StrMatch()) and calculation of hash values (StrHash()).

FUNCTIONS

char *StrAlloc(size_t size);
Allocate a string with size characters (including terminating zero). This string is freed again with StrFree().

char *StrAppend(char *target, char *source);
Append source at the end of target.

char *StrAppendMax(char *target, size_t max, const char *source);
Append source at the end of target. Make sure that the result does not exceed max characters. max must be greater than the length of target.

int StrContains(const char *string, const char *substring);
Returns true if string contains at least one appearance of substring.

char *StrCopy(char *target, const char *source);
Copy the contents of source to target.

char *StrCopyMax(char *target, size_t max, const char *source);
Copy the contents of source to target. Make sure that the result does not exceed max characters. Excessive characters are discarded in the result.

char *StrDuplicate(const char *source);
Allocate a new string which contains a copy of source.

char *StrDuplicateMax(const char *source, size_t max);
Allocate a new string which contains a copy of source. At most max characters are allocated and copied to the result.

int StrEqual(const char *first, const char *second);
Return true if first and second are equal. Not case-sensitive.

int StrEqualMax(const char *first, size_t max, const char *second);
Return true if at most the first max characters of first and second are equal. Not case-sensitive.

int StrEqualCase(const char *first, const char *second);

int StrEqualCaseMax(const char *first, size_t max, const char *second);

const char *StrError(int errno);

int StrFormat(char *target, const char *format, ...);

int StrFormatMax(char *target, size_t max, const char *format, ...);

int StrFormatDateMax(char *target, size_t max, const char *format, const struct tm *datetime);

int StrFree(char *target);
Free a string allocated by StrAlloc(), StrDuplicate(), or StrDuplicateMax().

unsigned long StrHash(const char *source, int type);

char *StrIndex(char *string, int character);

char *StrIndexLast(char *string, int character);

size_t StrLength(char *source);

int StrMatch(char *string, char *pattern);

int StrMatchCase(char *string, char *pattern);

int StrScan(char *source, const char *format, ...);

size_t StrSpanFunction(char *target, int (*Function)(int));

char *StrSubstring(const char *string, const char *substring);

char *StrSubstringMax(const char *string, size_t max, const char *substring);

char *StrTokenize(char *target, const char *delimiter);

double StrToDouble(const char *source, const char **target);

float StrToFloat(const char *source, const char **target);

long StrToLong(const char *source, const char **target, int base);

unsigned long StrToUnsignedLong(const char *source, const char **target, int base);

int StrToUpper(char *target);

SEE ALSO

trio_printf (3), trio_scanf (3)

LEGAL ISSUES

Copyright (C) 1998-2000 Bjorn Reese and Daniel Stenberg.

Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.

This HTML page was made with roffit.

Web page edited by daniel at haxx.se, modified April 05, 2005