Ns_StringPrint(3) library procedures

Other Alias

Ns_Match, Ns_NextWord, Ns_StrCaseFind, Ns_StrCopy, Ns_StrDup, Ns_StrNStr, Ns_StrToLower, Ns_StrToUpper, Ns_StrTrim, Ns_StrTrimLeft, Ns_StrTrimRight, ns_strcopy, ns_strdup

SYNOPSIS

#include "ns.h"



char *
Ns_Match(char *a, char *b)


char *
Ns_NextWord(char *line)


char *
Ns_StrCaseFind(char *s1, char *s2)


char *
Ns_StrCopy(char *str)
ns_strcopy(char *str)


char *
Ns_StrDup(char *str)
ns_strdup(char *str)


char *
Ns_StrNStr(char *pattern, char *expression)


char *
Ns_StrToLower(char *string)


char *
Ns_StrToUpper(char *string)


char *
Ns_StrTrim(char *string)


char *
Ns_StrTrimLeft(char *string)


char *
Ns_StrTrimRight(char *string)


void
Ns_StringPrint(char *string)



DESCRIPTION

Ns_Match(a, b)

Compare the beginnings of two strings, case insensitively. The comparison stops when the end of the shorter string is reached. Return NULL if no match, b if match.

Ns_NextWord(line)

Return a pointer to first character of the next word in a string; words are separated by white space. The returned pointer points into the original string. For example, Ns_NextWord("abc def") returns a pointer to the 'd' in that string.

Ns_StrCaseFind(s1, s2)

Locate the first occurrence of substring s2 within string s1 in a case-insensitive manner. The terminating ' ' characters are not compared. Returns a pointer that points into s1. Uses strstr(3) to do its work.

Ns_StrCopy(str)
ns_strcopy(str)

Copy a string or NULL value using Ns_Malloc. The Ns_StrCopy function is identical to the Ns_StrDup function but allows for the string parameter to be NULL, in which case Ns_StrCopy does nothing and returns NULL.

Ns_StrDup(str)
ns_strdup(str)

Copy a string using Ns_Malloc. The Ns_StrDup function calls Ns_Malloc to allocate enough memory to make a copy of the given string.

Ns_StrNStr(pattern, expression)

Search through pattern for expression, case insensitively. Return a pointer that points to where the match begins within pattern, or NULL if expression is not contained in pattern.

Ns_StrToLower(string)

Convert string to lowercase. Returns pointer to original string. Original string will be modified.

Ns_StrToUpper(string)

Convert string to uppercase. Returns pointer to original string. Original string will be modified.

Ns_StrTrim(string)

Trim leading and trailing white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not lose your original pointer to the string if you later need to free it.

Ns_StrTrimLeft(string)

Trim leading white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not lose your original pointer to the string if you later need to free it.

Ns_StrTrimRight(string)

Trim trailing white space from string. The original string pointer will be returned, but the string will have been modified: a ' 's will have been placed right after the last non-whitespace character of the string.

Ns_StringPrint(string)

Print a string to stdout.

KEYWORDS