Positron Compiler Documentation

ToLower

Positron8 · Revision 4.0.6.5 · PDF pages 372–373

Destination String = ToLower (Source String)

Convert the characters from a source string to lower case.

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.

' 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"
' 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"
View original PDF page 372Open page in PDFOriginal PDF page 372
' 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"
' 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,

Cdata, Len, Left$, Mid$, Right$, Str$, ToUpper, AddressOf.

View original PDF page 373Open page in PDFOriginal PDF page 373