[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] New functions to strip whitespace from strings
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] New functions to strip whitespace from strings |
Date: |
Tue, 12 Nov 2019 11:17:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi John.
Thanks for the patch.
+ /* Return S with leading whitespace omitted. */
+defun ltrim = (string s) string:
+ {
+ defvar result = "";
+ for (c in s)
+ {
+ if (c == ' ' || c == '\t' || result != "")
+ result = result + c as string;
+ }
+ return result;
+ }
Hm you mean (c == ' ' c == '\t') && result != "" above?
Also please include tests in testsuite/poke.std/ when introducing new
standard functions, and document them in doc/poke.texi. These would go
in a new chapter "String Functions". See the existing chapters under
"The Standard Library" for a reference.