Add specific character strings variables
Since some functions (such as concat) only accept strings. Therefore sometimes it is convenient to have characters as strings. E.g.
(defvar new-line (string #\Newline))
The we could use it in concat like this:
(str:concat "Hello" new-line "world")
It could be useful, especially for the whitespace characters (e.g. for space) but maybe also others. What do you think?
Some functions have been worked out to also accept characters:
(str:join #\Newline '( "hello" "test"))
so I think we should allow characters for all, including concat.
we should allow characters for all, including
concat
good idea. Could concat also accept numbers?
The only annoying thing with characters is the special syntax #\. So what you think if we define e.g. whitespace-characters as variable / constant to make it more "lispy" working with characters. For example:
(defvar new-line #\Newline)
(defconstant tab #\Tab)
Also one idea was introducing functions such as new-lines (or new-line?), that contain multiple times the same characters:
(defun new-lines (lines)
(let ((result ""))
(dotimes (var lines)
(setf result (str:concat result "
")))
result))
CL-USER> (new-lines 2)
"
"