lower case - a string processing function that returns a string argument with all letters in lowercase
lcase(string)
lcase works with variable-, fixed-length and constant strings. The result can be assigned to a variable or fixed-length string, and passed to a string parameter or function result.
The functions lcase and ucase are helpful in string comparison operations where tests need to be case insensitive.
This example loops through a string in search of the term 'basic' and prints the start position each time the term was found. The string function lcase is used to make the search case insensitive.
' SharpBASIC lcase programming example
' ------------------------------------
incl "lib/sys.sbi";
const text = "SharpBASIC is a great Basic programming language";
dim n: uint = 0;
main do
' loop through the text
loop do
' convert to lowercase and look for the term 'basic'
n = instr(lcase(text), "basic", n + 1);
' exit the loop if no more results
if n == 0 do
break;
end
print(n);
end
end
Output:
6
23