string-trim and cl-ppcre cannot trim #\Newline
<p>I use Clozure CL 1.11 on a raspberry pi (machine-type armv61, debian jessie) to run an oracle query via ojdbc7.jar:</p>
<pre><code>(defun query (statement)
  (let ((options   ; compiled java filename is Query.class 
        (list &quot;-cp&quot; &quot;/java-files-dir/ojdbc7.jar:/java-files-dir/&quot; &quot;Query&quot; statement))))))
    (with-output-to-string
        (stream)
      (ccl:run-program &quot;java&quot; options :output stream))))
</code></pre>
<p>The result looks like:</p>
<pre><code>&quot;DAVY 
JONES 

&quot;
</code></pre>
<p>When I coerce the resulting string into a list, I see that the columns are separated by <code>#\</code>  and <code>#\Newline</code>, whereas the end of the string contains one <code>#\</code>  and two <code>#\Newline</code> chars:</p>
<pre><code>(#\D #\A #\V #\Y #\  #\Newline #\J #\O #\N #\E #\S #\  #\Newline #\Newline)
</code></pre>
<p>I read <a href="https://stackoverflow.com/a/2640875/664404">this answer</a> and <a href="http://clhs.lisp.se/Body/f_stg_tr.htm" rel="nofollow noreferrer">CLHS</a> thoroughly, but still cannot understand why <code>string-trim</code> cannot trim anything with <code>#\newline</code>, <code>#\linefeed</code> or <code>#\return</code>, and</p>
<p><del>(cl-ppcre:regex-replace &quot;#\Newline&quot; (query &quot;...statement...&quot;) &quot;&quot;)</del><br />
(cl-ppcre:regex-replace #\Newline (query &quot;...statement...&quot;) &quot;&quot;)</p>
<p><strong>also doesn't work</strong>, whereas</p>
<pre><code>(cl-ppcre:split #\Newline (query &quot;...statement...&quot;))
</code></pre>
<p>successfully splits columns into a list like <code>(&quot;DAVY &quot; &quot;JONES &quot;)</code>.</p>
<h1>EDIT</h1>
<p>I noticed that the strikethroughed code above with <code>&quot;#\Newline&quot;</code> apparently caused a confusion that I may have called string-trim with &quot;#\Newline&quot;, but this was a typo.</p>
<p>Both calling <code>(cl-ppcre:regex-replace</code> #\newline<code> ...)</code> and <code>(string-trim '(#\Newline) ...)</code> cannot get rid of #\newlines.<br />
Actually I can handle my job by calling <code>(cl-ppcre:split #\Newline</code>, which I may even prefer in some circumstances.</p>
<p>However, I want to understand why calling string-trim with <code>'(#\Newline)</code> trims the #\Newlines at the end of the string, but cannot trim #\Newlines between the words.</p>