I came across this piece of text in my console output:
I:\u001b[2DA_O_T:\u001b[40C = -0.0
I know that I: and A_O_T: as well as = -0.0 is normal output so I conclude that \u001b[2D and \u001b[40C are escape sequences.
But I couldnt figure out what they do. I looked them up here: http://ascii-table.com/ansi-escape-sequences.php but couldn't find a match.
Does anyone know what 2D and 40C do in an escape sequence?
Related
something that could be like ${'c'?unicode} whould print 63 I went over the list of built-ins and didn't find anything like it.
There isn't, as of 2.3.27. It has come up for a few times, also the opposite of it (number to character), so maybe in 2.3.28. But, what's the use case?
we have a new client that needs there bar code created with mixing subset C and A. We are using the ZPL language to print to a zebra printer and I've followed the Zebra programming guide but cant get the output I'm after. I need the bar code to read:
9931265099999891DJS12345670100060020
My code looks like this:
^BY3^BCN,200,Y,N,N
^FD>;9931265099999891>7DJS>512345670100060020^FS
and outputs this with some other characters that are not even ascii:
9931265099999891 S7M &* ...
Can someone tell what I'm doing wrong
thank you
I figured out my own problem....
Thanks Magoo for taking time to look at my question...
When switching to subcode A you cannot just use the letters you want to display but must use a table (in the ZPL programming guide) that shows the characters that represent the characters that need to be displayed. I used this to get it to work, notice after changing to sub-code A (>7) you need duo characters to represent the characters you actually want displayed i.e..
36 = D
42 = J
51 = S
^BY2^BCN,200,Y,N,Y,N
^FD>;9931265099999891>7364251>512345670100060020^FS
Hope my solution helped someone else
cheers all
I got this to work using
^BCN,200,Y,N,N ^FD>;9931265099999891>6DJS1>52345670100060020^FS
Note that this switches to code B instead of A.
The final string of digits is an odd number of characters and it seemed to lop off the final character in code C. The string I constructed uses an even number of digits for each of the code-C sections and the remaining characters in code-B.
I could not get code-A to work at all, but I'm using an old printer (A300) which may not have the latest firmware.
I am trying to get the equivalent of LaTeX's $\tilde R$ in a Stata graph axis label. I don't thinks there's a SMCL way of doing that, but it's possible to use ASCII characters. However, there does not seem to be an ASCII code for an uppercase/capital R with a tilde above it.
Is there any way around that? Is it possible to combine ASCII characters somehow?
In Stata 14, this can be accomplished with:
`=ustrunescape("\u0052\u0303")'
This combines the Unicode for capital R with the one for tilde.
MVE:
sysuse auto, clear
tw scatter price mpg, title(`=ustrunescape("\u0052\u0303")')
should produce something like this (modulo scheme):
EDIT: From Stata 14. Stata supports Unicode.
ORIGINAL ANSWER for versions up to Stata 13:
The user-written program asciiplot (SSC) displays those characters available to you via char(), depending on what alphabet you are using. Your mileage may differ, but I see no such character.
Stata does not, at this writing, support LaTeX or over-striking or combinations of ASCII characters.
For example, I set up these:
L = /[a-z,A-Z,ßäüöÄÖÜ]/
V = /[äöüÄÖÜaeiouAEIOU]/
K = /[ßb-zBZ&&[^#{V}]]/
So that /(#{K}#{V}{2})/ matches "ᄚ" in "azAZᄚ".
Are there any better ways of dealing with them?
Could I put those constants in a module in a file somewhere in my Ruby installation folder, so I can include/require them inside any new script I write on my computer? (I'm a newbie and I know I'm muddling this terminology; Please correct me.)
Furthermore, could I get just the meta-characters \L, \V, and \K (or whatever isn't already set in Ruby) to stand for them in regexes, so I don't have to do that string interpolation thing all the time?
You're starting pretty well, but you need to look through the Regexp class code that is installed by Ruby. There are tricks for writing patterns that build themselves using String interpolation. You write the bricks and let Ruby build the walls and house with normal String tricks, then turn the resulting strings into true Regexp instances for use in your code.
For instance:
LOWER_CASE_CHARS = 'a-z'
UPPER_CASE_CHARS = 'A-Z'
CHARS = LOWER_CASE_CHARS + UPPER_CASE_CHARS
DIGITS = '0-9'
CHARS_REGEX = /[#{ CHARS }]/
DIGITS_REGEX = /[#{ DIGITS }]/
WORDS = "#{ CHARS }#{ DIGITS }_"
WORDS_REGEX = /[#{ WORDS }]/
You keep building from small atomic characters and character classes and soon you'll have big regular expressions. Try pasting those one by one into IRB and you'll quickly get the hang of it.
A small improvement on what you do now would be to use regex unicode support for categories or scripts.
If you mean L to be any letter, use \p{L}. Or use \p{Latin} if you want it to mean any letter in a Latin script (all German letters are).
I don't think there are built-ins for vowels and consonants.
See \p{L} match your example.
Has anyone in this forum attempted to solve the ACM programming problem http://acm.mipt.ru/judge/problems.pl?browse=yes&problem=024? It is one of the simpler problems in ACM MIPT and the goal is to evaluate an expression consisting of +, -, * and parentheses. Despite the apparent simplicity, I haven't been able to get my solution accepted, apparently because one of the test case expressions has an operator not stated in the problem. I even added support for division ('/') but that too didn't help. Any idea on what other operator needs to be supported? FYI, my program removes all whitespaces from the input before processing so that spaces shouldn't be a problem. Anything not stated in the problem but needs to be taken care of?
You're being bitten by ruby's handling of strings and characters.
curr_ch = #input[i]
gives you an integer, for the input you get, the ASCII code of the character at index i of the input.
curr_ch == '('
for example compares that integer to the string "(", of course that fails. Also the regex matches fail because you pass them an integer where a string is expected.
Replacing all occurrences of some_var = #input[some_index] with some_var = #input[some_index...some_index+1] gives me a programme that seems to work (it works on a few test inputs I gave it). Probably someone who actually knows the quirks of ruby can give you a better fix.