Skip to main content

Cardano Example Dapp

String Manipulation Functions​

This demo will test and explore basic string conversion and manipulation functions

Try it online:​

Source code:​

Dapp code was autogenerated by Playground IDE in GameChanger Wallet

GCScript code (dapp connection):​

{
"title": "String Manipulation Functions",
"description": "This demo will test and explore basic string conversion and manipulation functions",
"type": "script",
"exportAs": "StringDemo",
"returnURLPattern": "http://localhost:3000/demo/api/dapp",
"run": {
"payload": {
"type": "data",
"value": "🖖 Space: the final frontier. These are the voyages of the starship Enterprise. Its continuing mission: to explore strange new worlds. To seek out new life and new civilizations. To boldly go where no one has gone before!"
},
"prefix": {
"type": "macro",
"run": "{truncate(get('cache.payload'),28,0,'')}"
},
"suffix": {
"type": "macro",
"run": "{truncate(get('cache.payload'),0,42,'')}"
},
"sandwich": {
"type": "macro",
"run": "{truncate(get('cache.payload'),28,42,'...')}"
},
"toBase64": {
"type": "macro",
"run": "{strToBase64(get('cache.payload'))}"
},
"toHex": {
"type": "macro",
"run": "{strToHex(get('cache.payload'))}"
},
"toMetadataString": {
"type": "macro",
"run": "{strToMetadataStr(get('cache.payload'))}"
},
"fromBase64": {
"type": "macro",
"run": "{base64ToStr(get('cache.toBase64'))}"
},
"fromHex": {
"type": "macro",
"run": "{hexToStr(get('cache.toHex'))}"
},
"fromMetadataString": {
"type": "macro",
"run": "{metadataStrToStr(get('cache.toMetadataString'))}"
},
"split": {
"type": "macro",
"run": "{split('.',get('cache.payload'))}"
},
"join": {
"type": "macro",
"run": "{join('.',get('cache.split'))}"
},
"hexToBytes": {
"type": "macro",
"run": "{hexToByteArray(strToHex(get('cache.payload')))}"
},
"bytesToHex": {
"type": "macro",
"run": "{hexToStr(byteArrayToHex(get('cache.hexToBytes')))}"
}
}
}

Run standalone QR dapp connection:​

You can use Playground IDE in GameChanger Wallet in QR URL Transport mode to capture results

This GCScript/URL is too large! make it shorter uploading parts to GCFS. Unable to generate QR code

Resources​

License​

MIT