Class: String

String

Class for accessing bytes from a memory map as a string. The codec used to encode/decode the string is set in codec. The string may optionally contain the number of characters using a 32 bit unsigned number at the beginning. Otherwise, the string should be terminated with a NULL (0x00) character. If the string begins with the length, the number of bytes it occupies in the memory map will be 4 more than the defined string length.

Members


codec :string

Gets/sets the name of the codec used to encode/decode the string. For example, use 'Shift-JIS' to select a common 8-bit Japanese codec, or 'UTF-8' for a common 8-bit unicode codec.

Type:
  • string
Since:
  • 1.2 (WAT 1.3)
Default Value:
  • latin1

<readonly> maxLength :number

Gets the maximum number of characters in the string

Type:
  • number
Since:
  • 1.6 (WAT 2.2)

nullTerminate :bool

Determines if a NULL terminator is used to find the string length of strings. If this property is true, the resulting string will contain everything up to, but not included the first NULL terminator. If this property is false, or there is no NULL terminator in the string, then the resulting string will contain everything up to the maximum allowed length.

This does not apply to strings that have the length specified in the data.

Type:
  • bool
Since:
  • 1.7 (WAT 2.3)

value :string

Gets/sets the value of the string. cip.CIPVar#readOnly must be false in order to be able to write to this property.

Also accessible using the shorter named property 'v'.

Type:
  • string
Since:
  • 1.0 (WAT 1.0)

Events


valueChanged

Fires when the value changes as a result of a field bus update.

Parameters:
Name Type Description
newValue string

The new value of the string

Since:
  • 1.0 (WAT 1.0)