FireBirdLib - Topfield TMS PVR TAP Programming Library
UpperCase.c
Go to the documentation of this file.
1#include <ctype.h>
2#include <string.h>
3#include "FBLib_string.h"
4
5void UpperCase(char *string)
6{
8
9 char *p, *s;
10 byte UTF8[5];
11 byte BytesPerCharacter;
12
13 p = string;
14 while(*p)
15 {
16 isUTF8Char(p, &BytesPerCharacter);
17 if(BytesPerCharacter > 1)
18 {
19 memcpy(UTF8, p, BytesPerCharacter);
20 UTF8[BytesPerCharacter] = '\0';
21 s = strstr(UTF8Lower, UTF8);
22 if(s) memcpy(p, &UTF8Upper[(dword)s - (dword)UTF8Lower], BytesPerCharacter);
23 }
24 else
25 {
26 s = strchr(AnsiLower, *p);
27 if(s)
28 {
29 *p = AnsiUpper[(dword)s - (dword)AnsiLower];
30 }
31 else
32 *p = toupper(*p);
33 }
34
35 p += BytesPerCharacter;
36 }
37
38 TRACEEXIT();
39}
char AnsiUpper[30]
Definition: StrToUTF8.c:132
char UTF8Lower[64]
Definition: StrToUTF8.c:136
char AnsiLower[30]
Definition: StrToUTF8.c:133
char UTF8Upper[64]
Definition: StrToUTF8.c:135
void UpperCase(char *string)
Definition: UpperCase.c:5
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
bool isUTF8Char(const byte *p, byte *BytesPerChar)
Definition: isUTF8Char.c:3