LCASE$ function
Purpose: LCASE$ converts a string to lower case.
Syntax: RetStr = LCASE$(MainStr AS STRING) Return Value:
Parameters:
|
Example:
DIM RetStr$ RetStr$ = LCASE$("ABCDEFG") PRINT RetStr$
Result:
abcdefg
BCX Console Sample Programs using LCASE$ function.
MCASE$ function
Purpose: MCASE$ converts a string to Mixed Case. Mixed Case means the first letter of each word is Capitalized.
Syntax: RetStr = MCASE$(MainStr AS STRING) Return Value:
Parameters:
|
Example:
DIM RetStr$ RetStr$ = MCASE$("this is a test") PRINT RetStr$
Result:
This Is A Test
UCASE$ function
Purpose: UCASE$ converts a string to UPPER CASE.
Syntax: RetStr = UCASE$(MainStr AS STRING) Return Value:
Parameters:
|
Example:
DIM RetStr$ RetStr$ = UCASE$("abcdefg") PRINT RetStr$
Result:
ABCDEFG
BCX Console Sample Programs using UCASE$ function.
S03.bas, S27.bas, S36.bas, S61.bas, S81.bas, S94.bas, S99.bas
Example:
' --------------------------------------------------------------------------- ' CFC ( Change File Case ) version 1.0 by Kevin Diggins ' Changes the case of ALL file and directory names in the current directory ' Usage: CFC [U] [L] [M] ( U,L,M specifies UPPER, lower, or Mixed Case) ' --------------------------------------------------------------------------- ' Written for BCX -- The BASIC to C Translator and the LCC-WIN32 "C" compiler ' --------------------------------------------------------------------------- MACRO UPPER = 1 MACRO LOWER = 2 MACRO MIXED = 3 GLOBAL A$ , FCase IF ARGC = 1 THEN ? "----------------------------------------------------------------------" ? " CFC ( Change File Case ) by Kevin Diggins [- Freeware - ] " ? " Changes case of all file and directory names in the current directory " ? " Usage: CFC [U] [L] [M] (ULM specifies UPPER, lower, or Mixed Case) " ? "----------------------------------------------------------------------" ? " Made with BCX - The BASIC to C Translator & The LCC-Win32 C compiler " ? "----------------------------------------------------------------------" END END IF SELECT CASE UCASE$(COMMAND$) CASE "U" FCase = UPPER CASE "L" FCase = LOWER CASE "M" FCase = MIXED CASE ELSE ? "Usage: CFC [U] [L] [M] ( U,L,M specifies UPPER, lower, or Mixed Case)" END END SELECT A$ = FINDFIRST$("*.*") IF A$ <> "." AND A$ <> ".." AND A$ <> "" THEN RENAME A$ , ChangeCase$(A$) ? "Changing ", A$ , " to " , ChangeCase$(A$) END IF WHILE LEN(A$) > 0 A$ = FINDNEXT$ IF A$ <> "." AND A$ <> ".." AND A$ <> "" THEN RENAME A$ , ChangeCase$(A$) ? "Changing ", A$ , " to " , ChangeCase$(A$) END IF WEND FUNCTION ChangeCase$(A$) SELECT CASE FCase CASE UPPER FUNCTION = UCASE$(A$) CASE LOWER FUNCTION = LCASE$(A$) CASE MIXED FUNCTION = MCASE$(A$) CASE ELSE FUNCTION = A$ END SELECT END FUNCTION
$CASE_OFF and $CASE_ON directives
Purpose: When performing string comparisons, $CASE_OFF changes the default behavior to case insensitive until BCX encounters a $CASE_ON statement which restores the default, case sensitive, behavior.
Syntax 1: string comparisons are case sensitive $CASE_OFF string comparisons are case insensitive $CASE_ON string comparisons are case sensitive |
Remarks: Case sensitive string comparisons are the default in all BASIC language dialects.
Example:
IF "dog" = "DoG" THEN PRINT "Dogs are equal" ELSE PRINT "Dogs are not equal" $CASE_OFF ' Turn off case-sensitivity when comparing strings IF "dog" = "DoG" THEN PRINT "Dogs are equal" ELSE PRINT "Dogs are not equal" $CASE_ON' Turn on case-sensitivity when comparing strings IF "dog" = "DoG" THEN PRINT "Dogs are equal" ELSE PRINT "Dogs are not equal"
Result:
Dogs are not equal Dogs are equal Dogs are not equal