Skip to content

tuple_numberTupleNumberTupleNumbertuple_numbertuple_number🔗

Short description🔗

tuple_numberTupleNumberTupleNumbertuple_numbertuple_number — Convert a tuple (of strings) into a tuple of numbers.

Signature🔗

tuple_number( tuple T, out tuple Number )void TupleNumber( const HTuple& T, HTuple* Number )static void HOperatorSet.TupleNumber( HTuple t, out HTuple number )def tuple_number( t: MaybeSequence[Union[float, int, str]] ) -> Sequence[Union[float, int, str]]

def tuple_number_s( t: MaybeSequence[Union[float, int, str]] ) -> Union[float, int, str]Herror tuple_number( const char* T, double* Number )

Herror T_tuple_number( const Htuple T, Htuple* Number )

HTuple HTuple::TupleNumber( ) const

HTuple HTuple.TupleNumber( )

Description🔗

tuple_numberTupleNumber converts the input tuple Ttt into a tuple of numbers. If the input tuple contains numbers, they are simply copied into the output tuple. Strings are converted into the appropriate type of number (integer or floating point numbers) or are copied as strings if they do not represent a number. Note that strings starting with 0x are interpreted as hexadecimal numbers, and strings starting with 0 as octal numbers. For example, the string ‘20’ is converted to the integer 20, ‘020’ to 16, and ‘0x20’ to 32.

Exception: Empty input tuple🔗

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

Exception: Out of range integers🔗

If the input tuple contains strings with integers that cannot be represented as Hlong (32-bit signed integer for 32-bit HALCON, 64-bit signed integer for 64-bit HALCON), an exception is raised.

String padding🔗

If tuple_numberTupleNumber converts a string to a number, the same string with added leading and/or trailing spaces will be converted to the same number. Example: number(‘55.6’) == 55.6 and number(’ 55.6 ‘) == 55.6

HDevelop In-line Operation🔗

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

Number := number(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) tuple(-array) → (string / real / integer)HTuple (HString / double / Hlong)HTuple (string / double / int / long)MaybeSequence[Union[float, int, str]]Htuple (char* / double / Hlong)

Input tuple.

Numbernumbernumber (output_control) tuple(-array) → (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)Sequence[Union[float, int, str]]Htuple (double / Hlong / char*)

Input tuple as numbers.

Combinations with other operators🔗

Combinations

See also

tuple_is_numberTupleIsNumber, tuple_stringTupleString

Module🔗

Foundation