Community discussions

MikroTik App
 
alisc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 60
Joined: Thu Dec 01, 2011 10:51 am

How To definition of special character

Sat Feb 04, 2017 7:48 pm

Hi friends
I hope you are fine


How can I Definnition and use special character on Array ?
example : %^&*(*&^%$
# define char table
:global Number 0123456789
:global CharCap ABCDEFGHIJKLMNOPQRSTUVWXYZ
:global CharSpe !@#$%^&*()_+|\=-/.,<>?;':"[]{}
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: How To definition of special character

Sun Feb 05, 2017 4:26 am

Using a backslash (the character "\") followed by a hex of the ASCII value is the way for an arbitrary character.

Your particular example string (the value of CharSpe that is):
:global CharSpe "\21\40\23\24\25\5E\26\2A\28\29\5F\2B\7C\5C\3D\2D\2F\2E\2C\3C\3E\3F\3B\27\3A\22\5B\5D\7B\7D"
though many of those characters don't need to be escaped, and you can place "\" only in front of those that do need to be escaped, i.e.:
:global CharSpe "!@#\$%^&*()_+|\\=-/.,<>\?;':\"[]{}"