使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
strings.from_hex
strings.from_hex(hex_string)
说明
返回与给定十六进制字符串关联的字节。
参数数据类型
STRING
返回类型
BYTES
代码示例
获取与给定十六进制字符串关联的字节。
示例 1
以下示例展示了非十六进制字符转换。
strings.from_hex("str") // returns empty bytes
示例 2
以下示例显示了包含空字符串的输入。
strings.from_hex("") // returns empty bytes
示例 3
以下示例展示了十六进制字符串转换。
strings.from_hex("1234") // returns 1234 bytes
示例 4
以下示例展示了非 ASCII 字符转换。
strings.from_hex("筒纸.中国") // returns empty bytes
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-06-03。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-06-03。"],[[["`strings.from_hex` converts a hexadecimal string into its corresponding bytes representation, usable in Rules and Search."],["The function accepts a single string parameter (`STRING`) and returns a `BYTES` data type."],["Providing a non-hexadecimal string or an empty string to `strings.from_hex` results in empty bytes."],["Only hexadecimal strings, like `\"1234\"`, will be converted successfully to their byte values, as shown in the example."]]],[]]