String case: Difference between revisions

Content added Content deleted
m ((Dialects of BASIC moved to the BASIC section.))
(String case in various BASIC dialents (QBASIC, BASIC256, True BASIC, XBasic and Yabasic))
Line 704: Line 704:


LO$ = "" : FOR I = 1 TO LEN(S$) : C = ASC(MID$(S$, I, 1)) : LO$ = LO$ + CHR$(C + (C > 64 AND C < 91) * 32) : NEXT I : ? LO$</syntaxhighlight>
LO$ = "" : FOR I = 1 TO LEN(S$) : C = ASC(MID$(S$, I, 1)) : LO$ = LO$ + CHR$(C + (C > 64 AND C < 91) * 32) : NEXT I : ? LO$</syntaxhighlight>

==={{header|BASIC256}}===
<syntaxhighlight lang="freebasic">s$ = "alphaBETA"
print "Original string: "; s$
print "To Lower case: "; lower(s$)
print "To Upper case: "; upper(s$)</syntaxhighlight>


==={{header|BBC BASIC}}===
==={{header|BBC BASIC}}===
Line 828: Line 834:
upper$ = UCase(s$) ;uppercase
upper$ = UCase(s$) ;uppercase
lower$ = LCase(s$) ;lowercase</syntaxhighlight>
lower$ = LCase(s$) ;lowercase</syntaxhighlight>

==={{header|QBASIC}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
<syntaxhighlight lang="qbasic">s$ = "alphaBETA"
PRINT "Original string: "; s$
PRINT "To Lower case: "; LCASE$(s$)
PRINT "To Upper case: "; UCASE$(s$)</syntaxhighlight>


==={{header|Run BASIC}}===
==={{header|Run BASIC}}===
Line 838: Line 852:
==={{header|TI-83 BASIC}}===
==={{header|TI-83 BASIC}}===
Note: While lowercase letters are built in to every TI-83/4/+/SE calculator, typing in lowercase is disabled by default and you have to hack the calculator to type in lowercase. However, the calculator does not have to be hacked to simply display lowercase output from a program, so on non-hacked calculators this program will only be useful one-way. To get lowercase letters, you have to create a new program with "AsmPrgmFDCB24DEC9" as the text, and then execute it on the homescreen with Asm(prgmYOURPROGRAMNAME). Then press [ALPHA] twice.
Note: While lowercase letters are built in to every TI-83/4/+/SE calculator, typing in lowercase is disabled by default and you have to hack the calculator to type in lowercase. However, the calculator does not have to be hacked to simply display lowercase output from a program, so on non-hacked calculators this program will only be useful one-way. To get lowercase letters, you have to create a new program with "AsmPrgmFDCB24DEC9" as the text, and then execute it on the homescreen with Asm(prgmYOURPROGRAMNAME). Then press [ALPHA] twice.

==={{header|True BASIC}}===
<syntaxhighlight lang="qbasic">LET s$ = "alphaBETA"
PRINT "Original string: "; s$
PRINT "To Lower case: "; LCASE$(s$)
PRINT "To Upper case: "; UCASE$(s$)
END</syntaxhighlight>


==={{header|Visual Basic}}===
==={{header|Visual Basic}}===
Line 905: Line 926:
:sub(Str1,2,length(Str1)-2)→Str1
:sub(Str1,2,length(Str1)-2)→Str1
:Pause Str1</syntaxhighlight>
:Pause Str1</syntaxhighlight>

==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="xbasic">PROGRAM "StringCase"
VERSION "0.0000"

DECLARE FUNCTION Entry ()

FUNCTION Entry ()
s$ = "alphaBETA"
PRINT "Original string: "; s$
PRINT "To Lower case: "; LCASE$(s$)
PRINT "To Upper case: "; UCASE$(s$)

END FUNCTION
END PROGRAM</syntaxhighlight>

==={{header|Yabasic}}===
<syntaxhighlight lang="freebasic">s$ = "alphaBETA"
print "Original string: ", s$
print "To Lower case: ", lower$(s$)
print "To Upper case: ", upper$(s$)</syntaxhighlight>


=={{header|BCPL}}==
=={{header|BCPL}}==