tuple_chrttuple_chrtTupleChrtTupleChrt (Operator)

Name

tuple_chrttuple_chrtTupleChrtTupleChrt — Convert a tuple of integer numbers into strings.

Signature

tuple_chrt( : : T : Chrt)

Herror tuple_chrt(const Hlong T, char* Chrt)

Herror T_tuple_chrt(const Htuple T, Htuple* Chrt)

void TupleChrt(const HTuple& T, HTuple* Chrt)

HTuple HTuple::TupleChrt() const

static void HOperatorSet.TupleChrt(HTuple t, out HTuple chrt)

HTuple HTuple.TupleChrt()

Description

tuple_chrttuple_chrtTupleChrtTupleChrtTupleChrt converts the input tuple TTTTt, consisting of integer numbers, into a tuple of strings and integer numbers (where only the number 0 is passed as number to the output). All other numbers are converted to characters that are concatenated to one string up to the next 0 in the input tuple. When the encoding used in the HALCON library is UTF-8 (see set_system('filename_encoding', 'utf8')set_system("filename_encoding", "utf8")SetSystem("filename_encoding", "utf8")SetSystem("filename_encoding", "utf8")SetSystem("filename_encoding", "utf8")) and the string operators are set to work by code points (see set_system('tuple_string_operator_mode', 'codepoint')set_system("tuple_string_operator_mode", "codepoint")SetSystem("tuple_string_operator_mode", "codepoint")SetSystem("tuple_string_operator_mode", "codepoint")SetSystem("tuple_string_operator_mode", "codepoint")), which is the default for both, the operator interprets the input numbers as Unicode character codes and transforms them to the appropriate UTF-8 representations of the characters. When the HALCON library encoding is set to 'locale'"locale""locale""locale""locale" or the string operator mode is 'byte'"byte""byte""byte""byte", the operator accepts only numbers between 0 and 256. In that case they are interpreted as ANSI codes from which the output string has to be built byte by byte. In that mode it is not checked whether the byte sequences will build valid characters according to the current string encoding. See also Tuple / String Operations for a more detailed description of the different modes and further encoding issues.

The operator tries to pack as many input numbers into one string as possible. If the number 0 occurs in the input tuple TTTTt, the current string is terminated and the number 0 is added to the output tuple. If in the input tuple more numbers follow, a new string is started. This operator can be used to convert data read with read_serialread_serialReadSerialReadSerialReadSerial into strings. This approach allows also to read bytes with the value 0.

If the input tuple is empty, the operator returns an empty tuple.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_chrttuple_chrtTupleChrtTupleChrtTupleChrt, which can be used in an expression in the following syntax:

Chrt := chrt(T)

Execution Information

Parameters

TTTTt (input_control)  integer(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Input tuple with integer numbers.

Restriction: 0 <= T

ChrtChrtChrtChrtchrt (output_control)  string(-array) HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Output tuple with strings that are separated by the number 0.

Example (HDevelop)

read_serial (SerialHandle, 100, Data)
tuple_chrt (Data, Strings)

Alternatives

tuple_chrtuple_chrTupleChrTupleChrTupleChr

See also

tuple_ordtuple_ordTupleOrdTupleOrdTupleOrd, tuple_ordstuple_ordsTupleOrdsTupleOrdsTupleOrds, read_serialread_serialReadSerialReadSerialReadSerial

Module

Foundation