J. David Bryan wrote:
p.s. think "Trim" should trim both spaces and tab chrs ( now only spaces) low priority wish list
What does the standard say about this? (`Trim' is a predefined function of the standard, so we have to care about the standard here.)
Section 6.7.6.7 (String functions) in ISO 10206 (Extended Pascal) says for "Trim":
...the function shall yield the value of substr(sv,1,p-1), where p is the least value in the closed interval 1..n such that each component of sv[p..n] is the char-type value space.
So "Trim" only trims spaces.
Alternatively (if the standard wants only spaces), we could also make a different routine for spaces and tabs...
A different function would be the proper implementation.
I just noticed that the (non-standard) GPC procedures TrimLeft/TrimRight/TrimBoth and the equivalent functions TrimLeftStr/TrimRightStr/TrimBothStr do trim both spaces and tabs.
So I suppose they can be used here. Or are there any votes for making them trim only spaces like Trim does?
BTW, the same effect (trim all leading "space characters" (spaces and tabs)) could also be realized by:
uses GPC;
const NoSpaceCharacters = [Low (Char) .. High (Char)] - SpaceCharacters;
...
foo := Copy (s, CharPos (NoSpaceCharacters, s))
Frank
-- Frank Heckenbach, frank@fjf.gnu.de, http://fjf.gnu.de/ GPC To-Do list, latest features, fixed bugs: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html