Hardcoded string and assigned string acts differently - prawn

Working with ruby 1.9.3 --> when rendering text pdf.text "Hello \n World" it works as advertised.
However, if i pass it as a parameter from ARGV " \n " is just being displayed as text and not CR.
Checked encoding. both US-ASCII.
Any ideas?

"Hello '\n' World" - hope this helps)

Related

How to print plain text in POSTMAN Console without quotation marks?

I tried below in POSTMAN
console.log('Hello World');
console.log("Hello World");
Showing output in console as below in both the cases
"Hello World"
How to remove those quotation marks and print plain text in POSTMAN console like
Hello World
the syntax is :
console.log(val)
Different ways to represent string is to enclose the string with anyof :
double quotes :" , single quotes: ' and string literal: `
if you want to have string with the quotes escape it out or enclose with a different one
console.log("'Hello world'")
console.log("\"Hello world\"")
console.log('"Hello world'")
console.log(`"'Hello world"'`)
There is no built in way... but if you really want to follow these steps.
View > Developer > Show DevTools (Current Window)
Navigate to the Elements tab in the DevTools
ctrl + f for wf__qt (this will show you the element that holds the quotes
click on this element to see it's styles
in the styles pane, find the wf__qt class and uncheck the content: '"' style

Why doesnt raw_input in python accept more than 9 special characters

While writing a decode program in python, I have to get some garbled text as input But only the first 9 characters get accepted why? and how to make it accept everything
code is
print ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
print ",,To paste data click on the,,,"
print ",small icon at top left corner,"
print ",,Click on Edit and then Paste,"
print ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
print " "
print " "
b= raw_input("Enter string: ") or ""
print b
x=raw_input("press any key to exit....")
Also when I input this text I have to press enter twice
Download the file and then copy paste the input
link to garbled input
Your code works fine on my Python 3 (with IDLE). I'm pretty sure the issue is not because Python doesn't accept "more than 9 characters", but because it doesn't accept your 10th character. Try replacing it with something else, and if that works, you should try to figure out how to use all characters within your program.
Also, try adding this on top of your file, it might fix the problem with Python 2:
# -*- coding: utf-8 -*-
If that doesn't work, you should try decoding the string to utf-8:
b = raw_input('Enter string: ') # You don't need the `or ""`
b = b.decode('utf-8')
Or optionally to your system's default decoding:
import sys
b = raw_input('Enter string: ')
b = b.decode(sys.stdin.encoding)
If none of this works, the problem might be with your environment. Try executing the code in a Power Shell or similar. It might be that Windows's awful command prompt doesn't support all characters.

ASCII Art, Issue with Code Blocks C++

I can't understand why the "\" doesn't appear when i run the program. I want to make some ASCII Art and "\" is basic for the picture i want to make.Is there any solution? I am using Code Blocks .
With C++2011 you can use raw string literals, e.g.:
std::cout << R"(\)" << '\n';
The sequence R"( starts the string and )" ends the string. If the string )" needs to be embedded into the string, you can add some string between the " and the ( which then needs to be repeated between the ) and the " to end the string.
Of course, it may just be simpler to escape the escape character and to use \\ as you already mentioned.
You have to use 2 \ since the \ character is known as an escape key, like if you want to go to the next line you have to use \n and that lets C++ know that you want to move to the next line, so every time you use the \ character, you have to type it like \
I've found it. You have to enter 2 times the "\" and then it will appear.

Escape Characters in Linux Not Working

Say I want to print a string with quotes around it, ( "example" ).
In Linux, doing the same thing works in the simplest case. However, is there some reason in Linux that doing this will generate a new line at the end of the command? For instance, running my program in Windows:
std::cout<<"Blah \""<<example<<"\" Blah";
In Linux I have however
Blah "
example" Blah
Is there any reason why this should be happening? (Why am I getting this newline?)
Thanks again.
The way you are doing is wrong.
"Blah "\" << example << "\"Blah";
The above is wrong. "Blah "\" have closing double quotes before the backslashed double quotes.
This should work.
std::cout<<"Blah \""<<example<<"\" Blah";

How to recognize a string literal for a scanner in lex?

Ok, I have been trying to find a regular expression in lex that will recognize a C-like string literal in an input string. eg. in printf("stackoverflow"), "stackoverflow" should be recognized as a string literal.
I have been trying the following:
"[.]+"
["][.]+["]
\"[.]+\"
[\"][.]+[\"]
"""[.]+"""
None of these is working. The lexeme recognized each time is " alone. What should I do?
Thanks in advance...
Simple, try this:
\".*\" printf("STRING[%s]", yytext);
\'.*\' printf("STRING[%s]", yytext);
When compiled and run, a quick test shows it correctly parses strings like
"hello world!"
STRING["hello world!"]
'hello world!'
STRING['hello world!']
'john\'s cat'
STRING['john\'s cat']
'mary said "hello!"'
STRING['mary said "hello!"']
"frank said \"goodbye!\""
these are words "which contain" a string
these are words STRING["which contain"] a string
You may find these links helpful
ANSI C grammar, Lex
specification
ANSI C Yacc grammar