Skip to content

tuple_ordsTupleOrdsTupleOrdstuple_ordstuple_ords🔗

Short description🔗

tuple_ordsTupleOrdsTupleOrdstuple_ordstuple_ords — Convert a tuple of strings into a tuple of integer numbers.

Signature🔗

tuple_ords( string T, out integer Ords )void TupleOrds( const HTuple& T, HTuple* Ords )static void HOperatorSet.TupleOrds( HTuple t, out HTuple ords )def tuple_ords( t: MaybeSequence[Union[str, int]] ) -> Sequence[int]

def tuple_ords_s( t: MaybeSequence[Union[str, int]] ) -> intHerror tuple_ords( const char* T, Hlong* Ords )

Herror T_tuple_ords( const Htuple T, Htuple* Ords )

HTuple HTuple::TupleOrds( ) const

HTuple HTuple.TupleOrds( )

Description🔗

tuple_ordsTupleOrds converts the input tuple Ttt, which may only contain strings and integer numbers, into a tuple of integer numbers. 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 returns for the input strings the appropriate Unicode character codes. When the HALCON library encoding is set to 'locale'"locale" or the string operator mode is 'byte'"byte", the operator returns the ANSI code for every byte of the input string. In that mode, the result may depend on the currently used code page for strings that contain non-ASCII characters. See also Tuple / String Operations for a more detailed description of the different modes and further encoding issues.

The character codes of the individual strings are written to the output according to their order within the string and within the tuple. Integer numbers are simply copied to an appropriate position in the output tuple. This operator can be used to prepare outputs with write_serialWriteSerial. In particular, a byte with value 0 can be written by inserting the integer number 0 into Ttt.

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

HDevelop In-line Operation🔗

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

Ords := ords(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) string(-array) → (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)MaybeSequence[Union[str, int]]Htuple (char* / Hlong)

Input tuple with strings.

Ordsordsords (output_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Output tuple with the Unicode character codes or ANSI codes of the input string.

Example🔗

(HDevelop)

tuple_ords (['String 1', 0, 'String 2', 0], Data)
write_serial (SerialHandle, Data)

Combinations with other operators🔗

Combinations

Alternatives

tuple_ordTupleOrd

See also

tuple_chrTupleChr, tuple_chrtTupleChrt, write_serialWriteSerial

Module🔗

Foundation