Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Splitting 'character code strings' into individual characters in QM
#1
I need to transform "[65]" string into "[ 65]" in QM.
But QM interprets "[65]" as character code for 'A', not as "[" + "6" + "5" + "]" sequence.
So, this simple code doesn't work:
 
Code:
Copy      Help
_s = "[65]"
_s.replacerx("\[" "[ ")

But how do I get "[ 65]" from "[65]" then?
Is there any way of spliting 'character code strings' into individual characters?

Thanks for the answer!
#2
Code:
Copy      Help
_s = "[91]65]" ;;91 is character code of '['
out _s
#3
Thank you for your answer!

Actually, I know how to use escape characters and character codes in regular expressions.
Still, this one doesn't work for me.

For example, i need to transform "[65]: example string" into "[ 65]: example string".
"[65]" substring is not character code for 'A' in this case, it's just a text string.

The question remains to be answered:
How do I change "[65]: example string" into "[ 65]: example string" using regular expressions?
#4
In this case your replacerx code works. But you can use [91] in regex string too if need.

Code:
Copy      Help
_s = "[91]65]: example string"
_s.replacerx("\[" "[ ")
out _s


Forum Jump:


Users browsing this thread: 1 Guest(s)