mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 23:10:40 +00:00
ICU-8999 uprv_isASCIILetter()
X-SVN-Rev: 31117
This commit is contained in:
parent
b15c59f8dc
commit
46749f4d00
4 changed files with 22 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2003, International Business Machines
|
||||
* Copyright (C) 1997-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -46,6 +46,17 @@
|
|||
* and the set of uppercase Latin letters is discontiguous as well.
|
||||
*/
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isASCIILetter(char c) {
|
||||
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
return
|
||||
('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z') ||
|
||||
('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z');
|
||||
#else
|
||||
return ('a'<=c && c<='z') || ('A'<=c && c<='Z');
|
||||
#endif
|
||||
}
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_toupper(char c) {
|
||||
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
|
|
|
@ -41,6 +41,14 @@
|
|||
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
|
||||
#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
|
||||
|
||||
/**
|
||||
* Is c an ASCII-repertoire letter a-z or A-Z?
|
||||
* Note: The implementation is specific to whether ICU is compiled for
|
||||
* an ASCII-based or EBCDIC-based machine. There just does not seem to be a better name for this.
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isASCIILetter(char c);
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_toupper(char c);
|
||||
|
||||
|
|
|
@ -1248,8 +1248,6 @@ ulocimp_getLanguage(const char *localeID,
|
|||
return i;
|
||||
}
|
||||
|
||||
#define ISASCIIALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
|
||||
|
||||
U_CFUNC int32_t
|
||||
ulocimp_getScript(const char *localeID,
|
||||
char *script, int32_t scriptCapacity,
|
||||
|
@ -1263,7 +1261,7 @@ ulocimp_getScript(const char *localeID,
|
|||
|
||||
/* copy the second item as far as possible and count its length */
|
||||
while(!_isTerminator(localeID[idLen]) && !_isIDSeparator(localeID[idLen])
|
||||
&& ISASCIIALPHA(localeID[idLen])) {
|
||||
&& uprv_isASCIILetter(localeID[idLen])) {
|
||||
idLen++;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct ULanguageTag {
|
|||
#define LOCALE_KEYWORD_SEP ';'
|
||||
#define LOCALE_KEY_TYPE_SEP '='
|
||||
|
||||
#define ISALPHA(c) (((c)>='A' && (c)<='Z') || ((c)>='a' && (c)<='z'))
|
||||
#define ISALPHA(c) uprv_isASCIILetter(c)
|
||||
#define ISNUMERIC(c) ((c)>='0' && (c)<='9')
|
||||
|
||||
static const char* EMPTY = "";
|
||||
|
|
Loading…
Add table
Reference in a new issue