tuple_chrttuple_chrtTupleChrtTupleChrttuple_chrt (算子名称)

名称

tuple_chrttuple_chrtTupleChrtTupleChrttuple_chrt — Convert a tuple of integer numbers into strings.

参数签名

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()

def tuple_chrt(t: MaybeSequence[int]) -> Sequence[Union[str, int]]

def tuple_chrt_s(t: MaybeSequence[int]) -> Union[str, int]

描述

tuple_chrttuple_chrtTupleChrtTupleChrtTupleChrttuple_chrt converts the input tuple TTTTtt, 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")set_system("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")set_system("tuple_string_operator_mode", "codepoint")), which is the default for both, 该算子 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""locale" or the string operator mode is 'byte'"byte""byte""byte""byte""byte", 该算子 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.

该算子 tries to pack as many input numbers into one string as possible. If the number 0 occurs in the input tuple TTTTtt, 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_serialReadSerialReadSerialReadSerialread_serial into strings. This approach allows also to read bytes with the value 0.

If the input tuple is empty, 该算子 returns an empty tuple.

HDevelop In-line Operation

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

Chrt := chrt(T)

运行信息

参数表

TTTTtt (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Input tuple with integer numbers.

Restriction: 0 <= T

ChrtChrtChrtChrtchrtchrt (output_control)  string(-array) HTupleSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

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

例程 (HDevelop)

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

可替代算子

tuple_chrtuple_chrTupleChrTupleChrTupleChrtuple_chr

参考其它

tuple_ordtuple_ordTupleOrdTupleOrdTupleOrdtuple_ord, tuple_ordstuple_ordsTupleOrdsTupleOrdsTupleOrdstuple_ords, read_serialread_serialReadSerialReadSerialReadSerialread_serial

模块

Foundation