String (Variable)
A String is a chain of any characters. Any type of alphabetic or numeric Informationen can be saved as a String. „Heinz Erhardt“, „13.11.1981“, „23.42“ are examples of Strings. LunaAVR also allows you to put binary data in a String such as Null-Bytes. In the source code, include your String in Qquotes. The maximum length in LunaAVR is 254 Byte. The default String content is „“ (empty). LunaAVR stores strings in the Pascal-Format, embedded in a MemoryBlock-Object. Strings require at least 2 Byte in memory (Pointer to the MemoryBlock-Object). eeprom-Strings require the number of static Byte defined in the eeprom. A RAM Memory String is a 16-Bit Pointer to a MemoryBlock of dynamic size.
Properties (read only) | ||
---|---|---|
Name | Description | Return Type |
.Addr | Address of the Variable in Memory | word |
.Len | Read String length (number of characters) | byte |
.Ptr | Address of the allocated Memory-Blocks | word |
Methods (read/write) | ||
Name | Description | Return Type |
.ByteValue(offset) | individual Byte 1) | byte |
* offset: Byte-Position within the allocated Memory-Block, zero based. The first Byte is the String length identifier (offset = 0).
Notice
You may violate boundaries if exception is not declared. Boundary violation is not tested (faster).
Example
dim a as bte dim s as string s="Hello" a=s.ByteValue(0) ' Read Length Byte, output: 5 s=s.ByteValue(1) ' Read 1. character of text, output: 72 (Ascii-"H")