コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
strings.from_hex
strings.from_hex(hex_string)
説明
指定された 16 進文字列に関連付けられたバイト列を返します。
パラメータのデータ型
STRING
戻り値の型
BYTES
コードサンプル
指定された 16 進文字列に関連付けられたバイト列を取得します。
例 1
この例では、16 進数以外の文字の変換を示します。
strings.from_hex("str") // returns empty bytes
例 2
この例では、空の文字列を含む入力を示します。
strings.from_hex("") // returns empty bytes
例 3
この例では、16 進文字列の変換を示します。
strings.from_hex("1234") // returns 1234 bytes
例 4
この例では、ASCII 以外の文字の変換を示します。
strings.from_hex("筒纸.中国") // returns empty bytes
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-29 UTC。
[[["わかりやすい","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 UTC。"],[[["\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"]]