
LCase/UCase to work on .c
LCase/UCase to work on .c
LCase and UCase only work on strings. What about chars? 

Is it possible to change the case of a unicode character without changing it to a string? From a performance perspective I parse using character arrays because it deals purely with integers. For a string search I convert the input string to lower case before running a comparison.
I think this operation would be faster if I could change the case of only the characters I parse. But this only seems feasible without having to change the character to a string first.
I think this operation would be faster if I could change the case of only the characters I parse. But this only seems feasible without having to change the character to a string first.
Last edited by Mistrel on Sat Dec 27, 2008 1:03 pm, edited 1 time in total.
Note, that the ASCII-characters have a special offset.
Between 'A' and 'a' are 32 others characters:So you can easily add or substract 32 to each .c-variable to turn it into upper or lower case.
With pointer you can even scan whole strings.
Between 'A' and 'a' are 32 others characters:
Code: Select all
Debug 'a'-'A'
Debug 'b'-'B'
; and so on...
With pointer you can even scan whole strings.
PB 4.30
Code: Select all
onErrorGoto(?Fred)
Remember to check if it's actually a letter first. Subtracting 32 from a symbol like backspace will not create a "lower-case backspace".AND51 wrote:Note, that the ASCII-characters have a special offset.
Between 'A' and 'a' are 32 others characters:So you can easily add or substract 32 to each .c-variable to turn it into upper or lower case.Code: Select all
Debug 'a'-'A' Debug 'b'-'B' ; and so on...
- flaith
- Enthusiast
- Posts: 704
- Joined: Mon Apr 25, 2005 9:28 pm
- Location: $300:20 58 FC 60 - Rennes
- Contact:
Or with XOR
Code: Select all
a.c = Asc("A") ; = 65 ;1000001
; or
;a.c = Asc("a") ; = 97 ;1100001
Debug Chr(a)
b.c = a ! %00100000
Debug Chr(b)
“Fear is a reaction. Courage is a decision.” - WC