
# Cardano Example Dapp

## **String Manipulation Functions**

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


## Try it online: 

-  Visit [HTML+JS Dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/String%20Manipulation%20Functions.html)
-  Visit [HTML+React Dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/String%20Manipulation%20Functions_react.html)
-  Visit [Native HTML dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/String%20Manipulation%20Functions_nolib.html)
-  Run [Standalone URL dapp connection](https://wallet.gamechanger.finance/api/2/run/1-H4sIAAAAAAAAA6WUX27bMAzGr8L5JSlgOEFXDEPeWmzDBqzAsGYHYGw61iZLgkQn8Ypco6-74o4wyvm7LnEG9Cmi-OlH8jORx4QVa0omyQN7ZeZwj0a5RiMra-BDY_J4CEmaFBRyr1wMRT2tVICCagtLpTUwBQY0BdDKaesJZhhUDmHDzK1ZkO-IUVMflyiPSnDrYiebOhILzHq-Dfvu3klBuffEjTffvn7-gszkYz8Vs5uMRtrmqCsbePJ6PB6PYoMjdGpUoHPxYSPax8Rhqy0W8bgtWSCj5Beomxj-_vX0BA8Oc5oAVwSlMqih9NawIp_BtKJAgDJnzC5si3MKYMsuDIw-VMrBeyPNOa8CZfCJQ7SBlWmiI7UKQYYWut1bJmahmRMYWsLSel0EKWQhEP0A23B3r1VJnYcxyNVCafWz83GjnVld6Bbm8lUqEqSxYA1BhUHu5DCjUiq9StZp4jyVanVkQY25tzuPkkeW3xyZhnPi4SDHvKJs69vgKr1-m47TweBqHVGhKV-AGqc31weUzLZUefWCviIty7ItkO0dBnpzcx4otk-3opPMHecj9YzYQUTRS7gnxrhom12-ADsS90BlJetLA866_NQ-I-2cOUb1zljR6gREnhwT_nfG-qA7Af2bsuMHpxX32BbTw0E2SM_79d0qc54Qs88BHXX3vLPgrpV_uws2Rc2t99gO-zdjg51F4rR_w_buz3bof7CH7rbk9foP9rkN998FAAA)

## Source code:

- dapp connection code: [GCScript DSL](String%20Manipulation%20Functions.gcscript)
- frontend (using @gamechanger-finance/gc): [HTML+JS dapp](String%20Manipulation%20Functions.html)
- frontend (using @gamechanger-finance/gc): [HTML+React dapp](String%20Manipulation%20Functions_react.html)
- frontend (without official library): [Native HTML dapp](String%20Manipulation%20Functions_nolib.html)

Dapp code was autogenerated by [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)

## GCScript code (dapp connection):
```json
{
  "title": "String Manipulation Functions",
  "description": "This demo will test and explore basic string convertion 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 ](https://wallet.gamechanger.finance/playground) 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](String%20Manipulation%20Functions.png)](https://gamechangerfinance.github.io/gamechanger.wallet/examples/String%20Manipulation%20Functions.png)

## Resources
- [How to connect?](https://www.npmjs.com/package/@gamechanger-finance/gc)
- [Docs and examples on Github](https://github.com/GameChangerFinance/gamechanger.wallet/)
- [GCScript documentation](https://wallet.gamechanger.finance/doc/api/v2)
- [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)
- [Tutorials on Youtube](https://www.youtube.com/@gamechanger.finance)
- [Support on Discord](https://discord.gg/vpbfyRaDKG)
- [News on Twitter](https://twitter.com/GameChangerOk)
- [Website](https://gamechanger.finance)

## License
MIT 
    
