-
Notifications
You must be signed in to change notification settings - Fork 711
Closed
Description
Conversion to string-ascii
: to-ascii?
Originally proposed here.
to-ascii?
is a new Clarity function that converts simple values into their
string-ascii
representations.
- Input:
int
|uint
|bool
|principal
|(buff 524284)
|
(string-utf8 1048571)
- Output:
(response (string-ascii 1048571) uint)
- Signature:
(to-ascii? value)
- Description: Returns the
string-ascii
representation of the input value
in anok
response on success. The only error condition is if the input type
isstring-utf8
and the value contains non-ASCII characters, in which case,
(err u1)
is returned. - Example:
(to-ascii? true) ;; Returns (ok "true") (to-ascii? 42) ;; Returns (ok "42") (to-ascii? 'SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF) ;; Returns (ok "SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF") (to-ascii? 0x12345678) ;; Returns (ok "0x12345678")
See SIP proposal
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status: ✅ Done