Identifying Characters in a String?
-
Hey!
I have a label in my project that renames a file, I have put a button below to submit the text in the label. I put a if statement to check the text for unsupported characters in file naming:
\ / : * ? " < > |. I thought of making the if statement check the string using thecontains()function and putting the characters above into the parentheses of that function. However, the characters don't really play nice when I tried putting them in the parentheses! any ideas? Thanks again! -
Yeah you're going to run into issues using quotes and slashes because they have specific uses within a string.
You probably should use one of the regex functions. ChatGPT will help with regex, also this site - https://regex101.com/
-
@d-healey the regular escapes won't work with hise due to the syntax, but the unicode escape and hexadecimal escape doesn't work as well? I tried using the
Engine.matchesRegex()function inputting the regex string as"\u005C|\u002F|\u003A|\u002A|\u003F|\u0022|\u003C|\u003E|\u007C"for unicode and"\x5C|\x2F|\x3A|\x2A|\x3F|\x22|\x3C|\x3E|\x7C"in hex format -
@d-healey haha! got it to work, i love using regex!
"\\x5C|\\x2F|\\x3A|\\x2A|\\x3F|\\x22|\\x3C|\\x3E|\\x7C"