Good morning everybody!
How to display a string without the quotes?
Example:
q) show “string”
“string”
q) show “string”
string
Good morning everybody!
How to display a string without the quotes?
Example:
q) show “string”
“string”
q) show “string”
string
I managed to do it that way:
1"Hello, world!\n";
1"KDB+ - Q Language\n";
1"/n";
exit 0;
Is there another way to display a string without quotes?
Hi @eletrofone,
As you’ve mentioned, to print strings without the quotes you will need to send the string(s) to the file handle 1 (stdout).
If you to avoid ambiguity with ‘1’ in your code, you could set a variable for re-use e.g.
q)stdout:1; q)stdout each ((“hello”;“world”),:“\n”); hello world // use negative to append newline by default q)stdout:neg 1; q)stdout (“hello”;“world”); hello world // note, trailing semi-colon to supress outputting the file handle
Please see here for more info: Handles to files and processes | Basics | q and kdb+ documentation - Kdb+ and q documentation (kx.com)
Cheers,
David
negating the handle will append the newline
q)-1"hello, world";
hello, world
q)
q)-1("hello";"world");
hello
world
Note on the trailing semi-colon too; this supresses the file handle (1 or -1) being displayed