Positron Compiler Documentation

ToUpper

Source: Positron16 Compiler User Manual, PDF page 376

Syntax

Destination String = ToUpper (Source String)

Overview

Convert the characters from a source string to UPPER case.

Parameters

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, 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 code memory.

Example 1

' Convert the characters from SourceString to UpperCase and place into
' DestString
  Device = 24HJ128GP502
                                        ' Select the device to compile for
  Declare Xtal = 16
  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 = ToUpper(SourceString) ' Convert to uppercase
  Print DestString
                      ' Display the result, which will be "HELLO WORLD"

Example 2

' Convert the chars from a Quoted Character String to UpperCase
' and place into DestString
  Device = 24HJ128GP502
                                        ' Select the device to compile for
  Declare Xtal = 16
  Dim DestString as String * 20
                                        ' Create a String of 20 characters
  DestString = ToUpper("hello world") ' Convert to uppercase
  Print DestString
                           ' Display the result, which will be "HELLO WORLD"

Example 3

' Convert to UpperCase from SourceString into DestString using a pointer to
' SourceString
  Device = 24HJ128GP502
                                     ' Select the device to compile for
  Declare Xtal = 16
  Dim SourceString as String * 20
                                     ' Create a String of 20 characters
  Dim DestString as String * 20
                                     ' Create another String
  Dim StringAddr as Word ' Create a Word variable to hold address
  SourceString = "hello world"
                                     ' Load the source string with characters
  ' Locate the start address of SourceString in RAM
  StringAddr = AddressOf(SourceString)
  DestString = ToUpper(StringAddr) ' Convert to uppercase
  Print DestString
                      ' Display the result, which will be "HELLO WORLD"

Example 4

' Convert chars from a code memory string to uppercase
' and place into DestString
  Device = 24HJ128GP502
                                   ' Select the device to compile for
  Declare Xtal = 16
  Dim DestString as String * 20 ' Create a String of 20 characters
' Create a null terminated string of characters in code memory
  Dim Source as Code = hello world", 0
  DestString = ToUpper(Source) ' Convert to uppercase
  Print DestString
                      ' Display the result, which will be "HELLO WORLD"

See also : Creating and using Strings, Creating and using code memory strings,

Len, Left$, Mid$, Right$, Str$, ToLower, AddressOf .