Skip to content

tuple_chrtTupleChrtTupleChrttuple_chrttuple_chrt🔗

Short description🔗

tuple_chrtTupleChrtTupleChrttuple_chrttuple_chrt — Convert a tuple of integer numbers into strings.

Signature🔗

tuple_chrt( integer T, out string Chrt )void TupleChrt( const HTuple& T, HTuple* Chrt )static void HOperatorSet.TupleChrt( HTuple t, out HTuple chrt )def tuple_chrt( t: MaybeSequence[int] ) -> Sequence[Union[str, int]]

def tuple_chrt_s( t: MaybeSequence[int] ) -> Union[str, int]Herror tuple_chrt( const Hlong T, char* Chrt )

Herror T_tuple_chrt( const Htuple T, Htuple* Chrt )

HTuple HTuple::TupleChrt( ) const

HTuple HTuple.TupleChrt( )

Description🔗

tuple_chrtTupleChrt converts the input tuple Ttt, 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')) and the string operators are set to work by code points (see set_system('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" or the string operator mode is '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 Ttt, 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_serialReadSerial 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_chrtTupleChrt, which can be used in an expression in the following syntax:

Chrt := chrt(T)

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Ttt (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Input tuple with integer numbers.

Restriction: 0 <= T

Chrtchrtchrt (output_control) string(-array) → (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)Sequence[Union[str, int]]Htuple (char* / Hlong)

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

Example🔗

(HDevelop)

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

Combinations with other operators🔗

Combinations

Alternatives

tuple_chrTupleChr

See also

tuple_ordTupleOrd, tuple_ordsTupleOrds, read_serialReadSerial

Module🔗

Foundation