]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/cstring.h
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / common / cstring.h
CommitLineData
b75a7d8f
A
1/*
2******************************************************************************
3*
4* Copyright (C) 1997-2003, International Business Machines
5* Corporation and others. All Rights Reserved.
6*
7******************************************************************************
8*
9* File CSTRING.H
10*
11* Contains CString interface
12*
13* @author Helena Shih
14*
15* Modification History:
16*
17* Date Name Description
18* 6/17/98 hshih Created.
19* 05/03/99 stephen Changed from functions to macros.
20* 06/14/99 stephen Added icu_strncat, icu_strncmp, icu_tolower
21*
22******************************************************************************
23*/
24
25#ifndef CSTRING_H
26#define CSTRING_H 1
27
28#include "unicode/utypes.h"
29#include <string.h>
30#include <stdlib.h>
31#include <ctype.h>
32
33#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src)
34#define uprv_strcpyWithSize(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
35#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
36#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
37#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2)
38#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
39#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src)
40#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
41#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
42#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
43#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
44
45U_CAPI char U_EXPORT2
46uprv_toupper(char c);
47
48U_CAPI char U_EXPORT2
49uprv_tolower(char c);
50
51#define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base)
52#define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base)
53#ifdef WIN32
54# define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE _stricmp(str1, str2)
55# define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE _strnicmp(str1, str2, n)
56#elif defined(POSIX)
57# define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE strcasecmp(str1, str2)
58# define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE strncasecmp(str1, str2, n)
59#else
60# define uprv_stricmp(str1, str2) T_CString_stricmp(str1, str2)
61# define uprv_strnicmp(str1, str2, n) T_CString_strnicmp(str1, str2, n)
62#endif
63
64/* Conversion from a digit to the character with radix base from 2-19 */
65/* May need to use U_UPPER_ORDINAL*/
66#define T_CString_itosOffset(a) ((a)<=9?('0'+(a)):('A'+(a)-10))
67
68U_CAPI char* U_EXPORT2
69uprv_strdup(const char *src);
70
71U_CAPI char* U_EXPORT2
72T_CString_toLowerCase(char* str);
73
74U_CAPI char* U_EXPORT2
75T_CString_toUpperCase(char* str);
76
77U_CAPI int32_t U_EXPORT2
78T_CString_integerToString(char *buffer, int32_t n, int32_t radix);
79
80U_CAPI int32_t U_EXPORT2
81T_CString_stringToInteger(const char *integerString, int32_t radix);
82
83U_CAPI int U_EXPORT2
84T_CString_stricmp(const char *str1, const char *str2);
85
86U_CAPI int U_EXPORT2
87T_CString_strnicmp(const char *str1, const char *str2, uint32_t n);
88
89#endif /* ! CSTRING_H */