솔라나 문서코드형 인프라표준 라이브러리

16진수 함수

encode_hex

encode_hex는 버퍼 또는 문자열을 0x 접두사가 붙은 16진수 문자열로 인코딩합니다.

입력

이름타입설명
valuebuffer, string, addon인코딩할 버퍼 또는 문자열. '0x'로 시작하는 문자열은 16진수로 디코딩되며, 그렇지 않으면 원시 UTF-8 바이트가 사용됩니다.

출력

이름타입설명
valuestring0x 접두사가 붙은 16진수 표현의 입력값
output "encoded_hex" {
value = encode_hex("hello, world")
}
// > encoded_hex: 0x68656c6c6f2c20776f726c64

decode_hex

decode_hex는 16진수 문자열을 디코딩하여 결과를 버퍼로 반환합니다.

입력

이름타입설명
hex_stringstring디코딩할 16진수 문자열 (0x 접두사 포함 여부 무관)

출력

이름타입설명
valuebuffer버퍼로 변환된 디코딩된 16진수 문자열
output "decoded_hex" {
value = decode_hex("0x68656c6c6f2c20776f726c64")
}
// > decoded_hex: 0x68656c6c6f2c20776f726c64

Is this page helpful?

목차

페이지 편집