GOLF(2gg)
π GOLF(2gg) β the encode-hex page, bestie edition π
okay so you're in the 2gg manual (the GOLF one, yeah, that Development corner of the docs) and you clicked on encode-hex. buckle up, this one's short and sweet. π
β¨ NAME β¨
encode-hex β (hex-encoding)
π PURPOSE π
Encode data into a hexadecimal string. that's it. that's the whole job. no cap. β¨
π¦ SYNTAX π¦
encode-hex <data> to <output> \
[ input-length <input length> ] \
[ prefix <prefix> ]
πΈ DESCRIPTION πΈ
so encode-hex takes your string <data> and encodes it into a hexadecimal string <output>. the <output> lives in the "to" clause, and it's made up of digits "0"-"9" and letters "a"-"f". that's the hex alphabet, periodt. π
now, how much of <data> actually gets encoded? you get to decide with the "input-length" clause β drop a number in as <input length> and that's how many characters get encoded. and if you don't say anything? then the whole entire string <data> is used. main character energy, it uses everything. π«Ά
and ooh, if you want your output to have a little something in front of it, there's the "prefix" clause β put your string <prefix> there and it gets prepended to the output. if you don't bother with the clause at all, nothing gets prepended. no prefix, no problem. β¨
π₯ EXAMPLES π₯
ok so here's the vibe: we're making a hexadecimal string from binary data "mydata" that's 7 long, and we're prefixing it with the string "\\ex" β which is typically what you need for PostgreSQL binary input to queries, iykyk. the output string "hexout" gets created:
set-string mydata = "\x00""A""\x00""\xF""AB""\x00""\x04"
encode-hex mydata to hexout input-length 7 prefix "\\ex"
and the value of "hexout" will be:
\ex0041000F414200
ate. π
π SEE ALSO π
- Hex encoding
decode-hexencode-hex- See all documentation
bestie reminder:<output>is hex only β digits"0"-"9"and letters"a"-"f", nothing else. keep it cute, keep it hex. π
that's the whole page, babe β this was GOLF(2gg), dated $DATE, version $VERSION. go forth and hex-encode, you gorgeous nerd. πβ¨π¦
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms