Chapter Contents

Previous

Next
strxlt

strxlt



Translate a Character String

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <lcstring.h>

char *strxlt(char *str, const char *table);


DESCRIPTION

strxlt translates a null-terminated string from one character set to another. The first argument is the address of the string ( str ) to be translated. table is a pointer to a 256-byte translation table, which should be defined so that table[c] for any character c is the value to which c should be translated. (The function xltable can frequently be used to build such a table.)

The argument string is translated in place; that is, each character in the string is replaced by a translated character. The null character that terminates the string is never translated.


RETURN VALUE

The return value is a pointer to the translated string.


CAUTION

If the source string and the translation table overlap, the effect of strxlt is not defined.


IMPLEMENTATION

strxlt is implemented by inline code unless the function is undefined (by an #undef statement) to prevent this.


EXAMPLE

#include <lcstring.h>

char punctab[256] ;
char *number, *where;

   /* Build a table to interchange comma and period. */
xltable(punctab, ",.", ".,");
.
.
.

   /* Interchange comma and period for European      */
   /*  conventions.                                  */
if (strcmp(where, "Europe") == 0)
   strxlt(number, punctab);


RELATED FUNCTIONS

memxlt , strlwr , strupr , xltable


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.