User Tools

Site Tools


lcase

Table of Contents

lcase

lower case - a string processing function that returns a string argument with all letters in lowercase

syntax

lcase(string)

  • the string argument can be a string variable, constant, function or literal

See also instr, acase, pcase, tcase, ucase

details

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.

example

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

lcase.txt · Last modified: 2023/06/26 00:36 by admin