You can to specify #CharTable_Western (default) or #CharTable_Greek to select the used translation table.
Don't be shocked by the chaos-source-display in this forum, in the editor it will become well-structured.
The second code lets you wrap your system-charmapping used depending on your locale language settings. So if you ran it, it will create a formatted Datasection for usage with these procedures. So feel free to snip it and post it here!
The procedures UCaseEx and LCaseEx:
Code: Select all
;- UCaseEx, LCaseEx
;- let you specify another charmap, e.g. for another language
;-
;- the char-mapping bases on hashmaps from the DataSection
;-
;- if you need other languages, please let me know, it's easy to
;- implement them using the LUCaseWrapper-tool.
;-
;- by Froggerprogger
;-
;- 23.01.09 - added default parameters and example
;- 29.01.05 - created
;-
;/ some constants
#CharTable_Western = 0 ; (default)
#CharTable_Greek = 1
;/ the procedures
Procedure.s UCaseEx(p_str.s, p_tableID.l=#CharTable_Western)
Protected i.l, pos.l, tempB.b, offset.l
If p_tableID = #CharTable_Greek
offset = ?UCaseTableGreek
Else
offset = ?UCaseTableWestern
EndIf
For i=0 To Len(p_str)
pos = @p_str + i
PokeB(pos, PeekB(offset + PeekB(pos) & $FF) & $FF)
Next
ProcedureReturn p_str
EndProcedure
Procedure.s LCaseEx(p_str.s, p_tableID.l=#CharTable_Western)
Protected i.l, pos.l, tempB.b, offset.l
If p_tableID = #CharTable_Greek
offset = ?LCaseTableGreek
Else
offset = ?LcaseTableWestern
EndIf
For i=0 To Len(p_str)
pos = @p_str + i
PokeB(pos, PeekB(offset + PeekB(pos) & $FF) & $FF)
Next
ProcedureReturn p_str
EndProcedure
;/ the hashmaps
DataSection
UCaseTableWestern:
;///// .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
Data.b 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
;///// !! "" ## $$ %% && '' (( )) ** ++ ,, -- .. // 00 11 22 33 44 55 66 77 88 99 :: ;; << == >> ??
Data.b 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63
;///// @@ AA BB CC DD EE FF GG HH II JJ KK LL MM NN OO PP QQ RR SS TT UU VV WW XX YY ZZ [[ \\ ]] ^^ __
Data.b 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
;///// `` aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ {{ || }} ~~
Data.b 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127
;///// €€