New functions SB_ToLower and SB_ToUpper.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3821 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2001-2004 Ullrich von Bassewitz */
|
/* (C) 2001-2008 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -34,8 +34,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
#include "chartype.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "va_copy.h"
|
#include "va_copy.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
@@ -305,6 +307,34 @@ void SB_Move (StrBuf* Target, StrBuf* Source)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SB_ToLower (StrBuf* S)
|
||||||
|
/* Convert all characters in S to lower case */
|
||||||
|
{
|
||||||
|
unsigned I;
|
||||||
|
char* B = S->Buf;
|
||||||
|
for (I = 0; I < S->Len; ++I, ++B) {
|
||||||
|
if (IsUpper (*B)) {
|
||||||
|
*B = tolower (*B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SB_ToUpper (StrBuf* S)
|
||||||
|
/* Convert all characters in S to upper case */
|
||||||
|
{
|
||||||
|
unsigned I;
|
||||||
|
char* B = S->Buf;
|
||||||
|
for (I = 0; I < S->Len; ++I, ++B) {
|
||||||
|
if (IsLower (*B)) {
|
||||||
|
*B = toupper (*B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int SB_Compare (const StrBuf* S1, const StrBuf* S2)
|
int SB_Compare (const StrBuf* S1, const StrBuf* S2)
|
||||||
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */
|
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2001-2004 Ullrich von Bassewitz */
|
/* (C) 2001-2008 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -349,6 +349,12 @@ void SB_Move (StrBuf* Target, StrBuf* Source);
|
|||||||
* contents of Target, and Source will be empty after the call.
|
* contents of Target, and Source will be empty after the call.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void SB_ToLower (StrBuf* S);
|
||||||
|
/* Convert all characters in S to lower case */
|
||||||
|
|
||||||
|
void SB_ToUpper (StrBuf* S);
|
||||||
|
/* Convert all characters in S to upper case */
|
||||||
|
|
||||||
int SB_Compare (const StrBuf* S1, const StrBuf* S2);
|
int SB_Compare (const StrBuf* S1, const StrBuf* S2);
|
||||||
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */
|
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user