/* */
/* */
/* */
-/* (C) 2001-2004 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* (C) 2001-2008 Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
#include <string.h>
+#include <ctype.h>
/* common */
+#include "chartype.h"
#include "strbuf.h"
#include "va_copy.h"
#include "xmalloc.h"
/* Target will be empty */
SB_Clear (Target);
return;
- }
+ }
if (Start + Len > Source->Len) {
Len = Source->Len - Start;
}
+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)
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */
{
/* */
/* */
/* */
-/* (C) 2001-2004 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* (C) 2001-2008 Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
unsigned Len; /* Length of the string */
unsigned Index; /* Used for reading (Get and friends) */
char* Buf; /* Pointer to buffer */
-};
+};
/* An empty string buf */
extern const StrBuf EmptyStrBuf;
* 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);
/* Do a lexical compare of S1 and S2. See strcmp for result codes. */