Strings without quotes

Started by cormullion, July 08, 2006, 12:29:10 AM

Previous topic - Next topic

cormullion

With something like this:


$ 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:


$ date +"%Y-%m-%d %H:%M:%S"
2006-07-08 08:28:14

newdep

#1
newlisp -e '(date (date-value) 0 "%Y-%m-%d %H:%M:%S")'



(sym (date (date-value) 0 "%Y-%m-%d %H:%M:%S"))



Norman.
-- (define? (Cornflakes))

cormullion

#2
Thanks Norman, a perfect solution. I don't know enough about this stuff yet...!

Lutz

#3
.. not as short as Norman's solution but perhaps easier to understand:



~> 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