iefieldkit
iefieldkit copied to clipboard
General: Handling of special characters in locals
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
Add to utility functions
@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
@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.