
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM |
TEXT
Take care of international capitalization
Rick, I managed to change your UprString function and it seems to work but not entirely as I expected. I found that UprString fails to convert diacritics in some cases. I think it is not good to rely on UprString with diacSens set to true, but it is safe when it is set to false. For typographical purpose UpperText is better though.
I think also that UCASE$ should rather use UprString with diacSens false instead of the function built in the compiler which does what myUCASE$ (in the demo that follows) pretends to mimic in reply to a previous Lucy's post.
'===============
LOCAL MODE
DIM txtPtr&,lght
LOCAL FN UpperText$(theString$)
txtPtr& = @theString$+1
lght = LEN(theString$)
`
` MOVE.L ^txtPtr&,A0 ;put address of first char in A0
` MOVE.W ^lgth,D0 ;put length of string in D0
` DC.W uppertext ;trap number
`
END FN = theString$
'==============
LOCAL MODE
DIM txtPtr&,lgth
LOCAL FN UprString$(theString$, diacSens)
txtPtr& = @theString$+1
lght = LEN(theString$)
'
` move.l ^txtPtr&,a0
` move.w ^lght,d0
` tst.w ^diacSens
` beq.s L1
` dc.w $A054
` bra.s L2
`L1 dc.w $A254
`L2
END FN = theString$
'==============
LOCAL MODE
DIM count,number
LOCAL FN myUCASE$(theString$)
FOR count = 1 TO LEN(theString$)
number = PEEK(@theString$+count)
LONG IF number <= _"z"
LONG IF number >= _"a"
POKE @theString$+count,number-_" "
END IF
END IF
NEXT
END FN = theString$
'===============
WINDOW 1
CALL TEXTFONT(_courier):CALL TEXTSIZE(14)
CLS:PRINT
test$ = "a&Mac226;&Mac226;eÈËÍÎiÓÔoÙ&Mac246;u&Mac251;¸cÁ"
PRINT " Test ==> ";test$:PRINT
allCapsString$ = UCASE$(test$)
PRINT " UCASE$ ==> ";allCapsString$:PRINT
allCapsString$ = FN myUCASE$(test$)
PRINT " myUCASE$ ==> ";allCapsString$:PRINT
allCapsString$ = FN UprString$(test$, _false)
PRINT "UprString, diacSens = false ==> ";allCapsString$:PRINT
allCapsString$ = FN UprString$(test$, _true)
PRINT "UprString, diacSens = true ==> ";allCapsString$:PRINT
allCapsString$ = FN UpperText$(test$)
PRINT " UpperText ==> ";allCapsString$
DO
UNTIL FN BUTTON
|