File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -275,3 +275,29 @@ Checks if a string starts with a prefix.
275275local s = "hello world"
276276print(string.startswith(s, "hello")) --> true
277277```
278+ ---
279+ ### ` string.tohex `
280+ Converts a (binary) string to a hex representation.
281+ #### Parameters
282+ 1 . The string to convert.
283+ 2 . An optional bool to indicate that spaces should be used.
284+ 3 . An optional bool to indicate that the result should be upper-cased.
285+ #### Returns
286+ A new string.
287+ ``` pluto
288+ print("XYZ":tohex()) --> 58595a
289+ print("XYZ":tohex(true)) --> 58 59 5a
290+ print("XYZ":tohex(false, true)) --> 58595A
291+ print("XYZ":tohex(true, true)) --> 58 59 5A
292+ ```
293+ ---
294+ ### ` string.fromhex `
295+ Converts a hex string to binary.
296+ #### Parameters
297+ 1 . The string to convert.
298+ #### Returns
299+ A new string.
300+ ``` pluto
301+ print("58595a":fromhex()) --> XYZ
302+ print("58 59 5A":fromhex()) --> XYZ
303+ ```
You can’t perform that action at this time.
0 commit comments