Bob Warren wrote:
Alex:
I couldn't seem to make your first suggestions for L and R trims work.
Would you mind spelling out some example routines for me?
I've combined Mark Smith's versions, an alternate for one of his and
mine all in the following script.
Beware there are subtle differences in the results from the various
solutions presented (these here, and Thomas's regex-based ones).
The original question actually said "remove blanks", and mentioned the
LTRIM$ etc. functions in Basic.
In VB (I believe), LTRIM removes *only* spaces.
In other versions of Basics (and also in PHP, Python, Perl, etc.) Ltrim
(or equivalents) remove all whitespace characters (usually, spaces and
TABs).
So if that subtle difference matters, be careful which one you use.
--> all handlers
function trimL aString
return char offset(word 1 of aString, aString) to -1 of aString
end trimL
function trimR aString
return char 1 to length(word 1 to -1 of aString) + (offset(word 1
of aString, aString) - 1) of aString
end trimR
function trimRAlternate aString
return char 1 to (offset(word 1 of aString, aString) - 1) of
aString & word 1 to -1 of aString
end trimRAlternate
function agttrimL aString
return char 1 to -2 of (word 1 to -1 of (aString & "=")) --
could have been any non-space character
end agttrimL
function agttrimR aString
return char 2 to -1 of (word 1 to -1 of ("=" & aString))
end agttrimR
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.361 / Virus Database: 267.12.4/146 - Release Date: 21/10/2005
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution