Cardano Example Dapp
String Manipulation Functions
This demo will test and explore basic string conversion and manipulation functions
Try it online:
- Visit HTML+JS Dapp
- Visit HTML+React Dapp
- Visit Native HTML dapp
- Run Run in Wallet…Open in IDE…
Source code:
- dapp connection code: GCScript DSL
- frontend (using @gamechanger-finance/gc): HTML+JS dapp
- frontend (using @gamechanger-finance/gc): HTML+React dapp
- frontend (without official library): Native HTML dapp
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
Resources
- How to connect?
- Docs and examples on Github
- GCScript documentation
- Playground IDE in GameChanger Wallet
- Tutorials on Youtube
- Support on Discord
- News on Twitter
- Website
License
MIT
