Page 1 of 1
Strings without quotes
Posted: Sat Jul 08, 2006 7:29 am
by cormullion
With something like this:
Code: Select all
$ newlisp -e '(date (date-value) 0 "%Y-%m-%d %H:%M:%S")'
"2006-07-08 08:24:42"
How would you get rid of the quotes at either end of the string, for display purposes?
Cf the shell:
Code: Select all
$ date +"%Y-%m-%d %H:%M:%S"
2006-07-08 08:28:14
Posted: Sat Jul 08, 2006 7:49 am
by newdep
newlisp -e '(date (date-value) 0 "%Y-%m-%d %H:%M:%S")'
(sym (date (date-value) 0 "%Y-%m-%d %H:%M:%S"))
Norman.
Posted: Sat Jul 08, 2006 2:50 pm
by cormullion
Thanks Norman, a perfect solution. I don't know enough about this stuff yet...!
Posted: Sat Jul 08, 2006 3:17 pm
by Lutz
.. not as short as Norman's solution but perhaps easier to understand:
Code: Select all
~> newlisp -e '(silent (println (date (date-value) 0 "%Y-%m-%d %H:%M:%S")))'
2006-07-08 11:15:36
~>
the
silent is suppressing the return value, which carries the quotes. The
println than produces the output desired. And of course you could use
print to get rid of the line feed too.
Lutz