ToLower
Syntax
Destination String = ToLower (Source String)
Overview
Convert the characters from a source string to lower case.
Overview
Destination String can only be a String variable, and should be large enough to hold the correct amount of characters extracted from the Source String. Source String can be a String variable, or a Quoted String of Characters. The Source String can also be a Byte, Word, Long, Dword, Float or Array, variable, in which case the value contained within the variable is used as a pointer to the start of the Source String's address in RAM. A third possibility for Source String is a Label name, in which case a null terminated Quoted String of Characters is read from a Cdata table.
Example 1
' Convert the characters from SourceString to lowercase into DestString
'
Device = 18F26K40 ' A suitable device for Strings
Declare Xtal = 16 ' Tell the compiler the device is operating at 16MHz
Declare Hserial_Baud = 9600
Dim SourceString as String * 20 ' Create a String of 20 characters
Dim DestString as String * 20 ' Create another String
SourceString = "HELLO WORLD" ' Load the source string with characters
DestString = ToLower(SourceString) ' Convert to lowercase
HRsoutLn DestString ' Display the result, which will be "hello world"
Example 2
' Convert the characters from a Quoted Character String to lowercase
' into DestString
'
Device = 18F26K40 ' A suitable device for Strings
Declare Xtal = 16 ' Tell the compiler the device is operating at 16MHz
Declare Hserial_Baud = 9600
Dim DestString as String * 20 ' Create a String of 20 characters
DestString = ToLower("HELLO WORLD") ' Convert to lowercase
HRsoutLn DestString ' Display the result, which will be "hello world"
Example 3
' Convert to lowercase from SourceString into DestString using a pointer to
' SourceString
'
Device = 18F26K40 ' A suitable device for Strings
Declare Xtal = 16 ' Tell the compiler the device is operating at 16MHz
Declare Hserial_Baud = 9600
Dim SourceString as String * 20 ' Create a String of 20 characters
Dim DestString as String * 20 ' Create another String
'
' Create a Word variable to hold the address of SourceString
'
Dim StringAddr as Word
SourceString = "HELLO WORLD" ' Load the source string with characters
'
' Locate the start address of SourceString in RAM
'
StringAddr = AddressOf(SourceString)
DestString = ToLower(StringAddr) ' Convert to lowercase
HRsoutLn DestString ' Display the result, which will be "hello world"
Example 4
' Convert chars from a Cdata table to lowercase and place into DestString
'
Device = 18F26K40 ' A suitable device for Strings
Declare Xtal = 16 ' Tell the compiler the device is operating at 16MHz
Declare Hserial_Baud = 9600
Dim DestString as String * 20 ' Create a String of 20 characters
'
' Create a null terminated string of characters in flash memory
'
Dim Source as Flash8 = "HELLO WORLD", 0
DestString = ToLower(Source) ' Convert to lowercase
HRsoutLn DestString ' Display the result, which will be "hello world"
See also : Creating and using Strings, Creating and using Virtual Strings with Cdata,

