透過集合功能整理內容
你可以依據偏好儲存及分類內容。
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
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-29 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-29 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003estrings.from_hex\u003c/code\u003e converts a hexadecimal string into its corresponding bytes representation, usable in Rules and Search.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts a single string parameter (\u003ccode\u003eSTRING\u003c/code\u003e) and returns a \u003ccode\u003eBYTES\u003c/code\u003e data type.\u003c/p\u003e\n"],["\u003cp\u003eProviding a non-hexadecimal string or an empty string to \u003ccode\u003estrings.from_hex\u003c/code\u003e results in empty bytes.\u003c/p\u003e\n"],["\u003cp\u003eOnly hexadecimal strings, like \u003ccode\u003e"1234"\u003c/code\u003e, will be converted successfully to their byte values, as shown in the example.\u003c/p\u003e\n"]]],[],null,["### strings.from_hex\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n strings.from_hex(hex_string)\n\n#### Description\n\nReturns the bytes associated with the given hex string.\n\n#### Param data types\n\n`STRING`\n\n#### Return type\n\n`BYTES`\n\n#### Code samples\n\nGet bytes associated with a given hex string.\n\n##### Example 1\n\nThis example shows non-hex character conversions. \n\n strings.from_hex(\"str\") // returns empty bytes\n\n##### Example 2\n\nThis example shows input with empty string. \n\n strings.from_hex(\"\") // returns empty bytes\n\n##### Example 3\n\nThis example shows hex string conversion. \n\n strings.from_hex(\"1234\") // returns 1234 bytes\n\n##### Example 4\n\nThis example shows non-ASCII characters conversion. \n\n strings.from_hex(\"筒纸.中国\") // returns empty bytes"]]