tuple_ordtuple_ordTupleOrdTupleOrdtuple_ord (算子)

名称

tuple_ordtuple_ordTupleOrdTupleOrdtuple_ord — 将长度为 1 的字符串元组转换为整数元组。字符串转换为 ANSI 整数。单个字符的数组将转换为整数数组。Ord 是 ordinal 的缩写,也就是 ASCII/ANSI 码的序号。

签名

tuple_ord( : : T : Ord)

Herror tuple_ord(const char* T, Hlong* Ord)

Herror T_tuple_ord(const Htuple T, Htuple* Ord)

void TupleOrd(const HTuple& T, HTuple* Ord)

HTuple HTuple::TupleOrd() const

static void HOperatorSet.TupleOrd(HTuple t, out HTuple ord)

HTuple HTuple.TupleOrd()

def tuple_ord(t: MaybeSequence[str]) -> Sequence[int]

def tuple_ord_s(t: MaybeSequence[str]) -> int

描述

tuple_ordtuple_ordTupleOrdTupleOrdTupleOrdtuple_ord converts the input tuple TTTTtt, which may only contain strings of length 1, into a tuple of integer numbers. 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, the operator accepts the UTF-8 representation of a Unicode character (code point) and returns the appropriate Unicode character code. 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", the operator accepts only a single byte for each input string. In that case the operator tuple_ordtuple_ordTupleOrdTupleOrdTupleOrdtuple_ord returns the ANSI code of the input byte as integer number between 0 and 256. See also Tuple / String Operations for a more detailed description of the different modes and further encoding issues.

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

HDevelop 内联操作

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

Ord := ord(T)

执行信息

参数

TTTTtt (输入控制)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with strings of length 1.

OrdOrdOrdOrdordord (输出控制)  integer(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Output tuple with Unicode character codes or ANSI codes of the characters passed in the input tuple.

替代

tuple_ordstuple_ordsTupleOrdsTupleOrdsTupleOrdstuple_ords

另见

tuple_chrtuple_chrTupleChrTupleChrTupleChrtuple_chr, tuple_chrttuple_chrtTupleChrtTupleChrtTupleChrttuple_chrt

模块

基础