Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: Handling of special characters in locals #147

Open
luizaandrade opened this issue Apr 28, 2020 · 3 comments
Open

General: Handling of special characters in locals #147

luizaandrade opened this issue Apr 28, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@luizaandrade
Copy link
Member

Luiza: Should probably find a way to keep these (special characters) in the future.
Ben: Agree. At least it would be better to have a good list of what can and can't be handled well and what code conventions are needed to handle what characters.

Originally posted by @luizaandrade in https://github.com/_render_node/MDIzOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFkMjU5MjAzMzAxOnYy/pull_request_review_threads/discussion

@luizaandrade luizaandrade added the enhancement New feature or request label Apr 29, 2020
@kbjarkefur
Copy link
Contributor

Add to utility functions

@bbdaniels bbdaniels changed the title Should probably find a way to keep these in the future General: Handling of special characters in locals Jul 23, 2020
@bbdaniels
Copy link
Contributor

@kbjarkefur here is what I typically do, for reference:

    // Clean up common characters
    foreach character in , . < > / [ ] | & ! ^ + - : = ( ) # "{" "}" "`" "'" {
      replace v1 = subinstr(v1,"`character'"," ",.)
    }
      replace v1 = subinstr(v1, char(34), "", .) // Remove " sign
      replace v1 = subinstr(v1, char(96), "", .) // Remove ` sign
      replace v1 = subinstr(v1, char(36), "", .) // Remove $ sign
      replace v1 = subinstr(v1, char(10), "", .) // Remove line end

@kbjarkefur
Copy link
Contributor

kbjarkefur commented Jul 23, 2020

@bbdaniels here is how you can modify locals without interpret them:

*Do not interpret macros
local line : subinstr local line "\$"  "\\$"
local line : subinstr local line "\`"  "\\`"

This code snippet comes from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants