Positron Compiler Documentation

Strn

Positron8 · Revision 4.0.6.5 · PDF page 369

Strn Byte Array = Item

Load a Byte Array with null terminated data, which can be likened to creating a pseudo String variable.

Byte Array is the variable that will be loaded with values. Item can be another Strn command, a Str command, Str$ command, or a quoted character string

' Load the Byte Array String1 with null terminated characters

  Device = 18F26K40                  ' A suitable device for Strings
  Declare Xtal = 16          ' Tell the compiler the device is operating at 16MHz
  Declare Hserial_Baud = 9600

  Dim String1[21] as Byte   ' Create a Byte array with 21 elements

  Strn String1 = "Hello World"
  ' Load String1 with characters and null terminate it
  HRsoutLn Str String1      ' Display the string
  Stop

See also: Arrays as Strings, Str$.

View original PDF page 369Open page in PDFOriginal PDF page 369