# #include "string.h"

This page has information from files string.h and string.c.

## Contents

- Public Routines
- Public Definitions
- Introduction

## Public Routines in File string.c

#### Index

initial_substring | new_str_copy | str_to_int | which_string_member
itoa | reverse_chars | string_member |
natural_string | str_ident | substring |

#### Details

    BOOL initial_substring(char *x, char *y);

Is x an initial substring of y?

    char *itoa(int n, char *s);

This routine converts an integer to a string (in decimal form). The character array s must be large enough to hold the string. The string is returned.

    int natural_string(char *str);

    char *new_str_copy(char *str);

Return a malloced copy of the given string. To avoid memory leaks, call free() on the copy if you finish referring to it.

    void reverse_chars(char *s, int start, int end);

This routine reverses an array of characters. You must give the starting and ending positions.

    BOOL str_ident(char *s, char *t);

This function routine checks identity of two strings.

    BOOL str_to_int(char *str, int *ip);

This routine tries to convert a string into an integer (using strtol()). If successful, TRUE is returned and *ip is set to the integer. If failure, FALSE is returned.

    BOOL string_member(char *string, char **strings, int n);

Is "string" a member of an array of "strings"?

    BOOL substring(char *x, char *y);

Is x a substring of y?

    int which_string_member(char *string, char **strings, int n);

If "string" is a member of an array of "strings", return the index; else return -1.

## Public Definitions in File string.h

## Introduction

This package contains a few utilities for character strings.