FireBirdLib - Topfield TMS PVR TAP Programming Library
LowerCase.c
Go to the documentation of this file.
1#include <ctype.h>
2#include <string.h>
3#include "FBLib_string.h"
4
5void LowerCase(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(UTF8Upper, UTF8);
22 if(s) memcpy(p, &UTF8Lower[(dword)s - (dword)UTF8Upper], BytesPerCharacter);
23 }
24 else
25 {
26 s = strchr(AnsiUpper, *p);
27 if(s)
28 {
29 *p = AnsiLower[(dword)s - (dword)AnsiUpper];
30 }
31 else
32 {
33 *p = tolower(*p);
34 }
35 }
36
37 p += BytesPerCharacter;
38
39 }
40
41 TRACEEXIT();
42}
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 LowerCase(char *string)
Definition: LowerCase.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