On 2009 Jan 12, at 15:17, Ovid wrote:
בָּרוּךְ שֵׁם כְּבוֹד מַלְכוּתוֹ
לְעוֹלָם וָעֶד.
If you can't see that in your client, that's Hebrew from http://www.i18nguy.com/unicode/shma.html
and means Hear O Israel, the Lord is our God, the Lord is One.
Actually that's the
- Original Message
From: Ovid publiustemp-perl6interna...@yahoo.com
This patch implements the .trim() method for strings.
Now that I'm reading S29, I see there is no .trim() method there. I got that
because it was referenced in pugs in the cookbook (not in tests, though) and
Ovid ():
=item trim
our Str multi Str::trim ( Str $string )
Removes leading and trailing whitespace from a string.
=cut
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Setting leading or trailing to false (they default to true)
- Original Message
=item trim
our Str multi Str::trim ( Str $string )
Removes leading and trailing whitespace from a string.
=cut
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Setting leading or
- Original Message
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Alternatively, those could be ltrim() and rtrim(). If you need to dynamically
determine what you're going to trim, you'd couldn't just set variables to do
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-12 16:05]:
Or all could be allowed and $string.trim(:leading0) could all
$string.rtrim internally.
++
Regards,
--
Aristotle Pagaltzis // http://plasmasturm.org/
Aristotle Pagaltzis wrote:
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-12 16:05]:
Or all could be allowed and $string.trim(:leading0) could all
$string.rtrim internally.
++
Note you can write it :!leading too. :-)
Jonathan
On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote:
: ...the trivial $string.trim and trim($string) case.
Hmm, I'd think .trim should work like .chomp, and return the trimmed
string without changing the original. You'd use $str.=trim to do it
in place.
Can't say I really like the negated
Ovid wrote:
- Original Message
In the pir, doesn't the s = self line copy self, thus ensuring that I'm changing s and not self?
No, it's binding.
Or do I need s = clone self (or however it's written).
Yeah, but also note that substr would return a copy...
Can't say I
Jonathan (), Ovid (), Larry ():
Can't say I really like the negated options though. They smell funny.
Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike.
Suggestions welcome as I can't think of anything better.
The .Net framework calls 'em TrimStart and TrimEnd (and
On Mon, 2009-01-12 at 07:01 -0800, Ovid wrote:
- Original Message
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Alternatively, those could be ltrim() and rtrim(). If you need to
dynamically determine what you're
- Original Message
Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike.
Suggestions welcome as I can't think of anything better.
The .Net framework calls 'em TrimStart and TrimEnd (and has a Trim that does
both). So maybe trim_start and trim_end if we
- Original Message
From: Geoffrey Broadwell ge...@broadwell.org
When I saw your proposed syntax above, instead of reading don't trim
leading/trailing whitespace, I read change the definition of
'whitespace' to 'codepoint 0' for leading/trailing.
That of course raises the question
On Mon, Jan 12, 2009 at 09:33:32AM -0800, Geoffrey Broadwell wrote:
: That of course raises the question of how one *would* properly override
: trim's concept of whitespace
Well, given that .trim is essentially just .comb(/\S.*\S/), which in
turn is really just m:g/(\S.*\S)/, I don't see
Larry Wall wrote:
On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote:
: ...the trivial $string.trim and trim($string) case.
Hmm, I'd think .trim should work like .chomp, and return the trimmed
string without changing the original. You'd use $str.=trim to do it
in place.
Can't say I really
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-12 18:40]:
1. No params, trim all
2. :start or :end, only trim that bit (not a negated option :)
3. If both, goto 1
Also `:!start` to imply `:end` unless `:!end` (which in turn
implies `:start` unless `:!end`)?
I’d like not to have to
On Mon, Jan 12, 2009 at 2:50 PM, Aristotle Pagaltzis pagalt...@gmx.de wrote:
I'd like not to have to type `.trim(:start)` when I could just do
`.ltrim` though.
As long as we gloss .ltrim as leading trim rather than left trim.
Then the other end could be .ttrim for trailing?
We really ought to
- Original Message
Also `:!start` to imply `:end` unless `:!end` (which in turn
implies `:start` unless `:!end`)?
I’d like not to have to type `.trim(:start)` when I could just do
`.ltrim` though.
So what would .ltrim do with this?
בָּרוּךְ שֵׁם כְּבוֹד מַלְכוּתוֹ לְעוֹלָם
* Aristotle Pagaltzis pagalt...@gmx.de [2009-01-12 20:55]:
Also `:!start` to imply `:end` unless `:!end` (which in turn
implies `:start` unless `:!end`)?
Ugh, forget this, I was having a blank moment.
Actually that makes me wonder now whether it’s actually a good
idea at all to make the
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-12 21:20]:
Since that's RTL (Right To Left) text, should ltrim remove the
leading or trailing whitespace?
I like Jonathan's trim_start and trim_end.
Let me ask you first: does a string that runs Right-to-Left start
at the left and end at
On Mon, Jan 12, 2009 at 09:18:03PM +0100, Aristotle Pagaltzis wrote:
: Plus if there are separate `.ltrim` and `.rtrim` functions it
: would be better to implement `.trim` by calling them rather than
: vice versa, so it wouldn’t even be less efficient two make two
: calls rather than a
Aristotle Pagaltzis wrote:
Actually that makes me wonder now whether it’s actually a good
idea at all to make the function parametrisable at all. Even
`.ltrim.rtrim` is shorter and easier than `.trim(:start,:end)`!
How about .trim(:l, :r) with both as the default? And if the rtl crowd
- Original Message
From: Aristotle Pagaltzis pagalt...@gmx.de
I like Jonathan's trim_start and trim_end.
Let me ask you first: does a string that runs Right-to-Left start
at the left and end at the right or start at the right and end at
the left?
Now to answer your question,
* Larry Wall la...@wall.org [2009-01-12 21:55]:
* Aristotle Pagaltzis pagalt...@gmx.de [2009-01-12 21:20]:
Plus if there are separate `.ltrim` and `.rtrim` functions it
would be better to implement `.trim` by calling them rather
than vice versa, so it wouldn’t even be less efficient two
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-12 22:05]:
I see your point
And now I see yours. I was visualising the memory layout of a
string, wherein a right-to-left string gets displayed from the
right end of it’s in-memory representation so “left” and “right”
are absolutes in that
* Austin Hastings austin_hasti...@yahoo.com [2009-01-12 22:00]:
How about .trim(:l, :r) with both as the default?
Liveable.
And if the rtl crowd makes a furor, we can add :a/:o or :ת/:א
or something.
*grin*
Maybe :h and :t (head/tail).
Useful for doing infrequent things. IMO, left and
- Original Message
From: Aristotle Pagaltzis pagalt...@gmx.de
* Austin Hastings [2009-01-12 22:00]:
How about .trim(:l, :r) with both as the default?
Liveable.
I've just committed the pugs tests for trim. However, it's just 'trim' with no
left/right, leading/trailing,
- Original Message
From: jesse je...@fsck.com
On Mon, Jan 12, 2009 at 07:01:25AM -0800, Ovid wrote:
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Alternatively, those could be ltrim() and rtrim().
'left'
On 2009-01-12 Ovid publiustemp-perl6interna...@yahoo.com wrote:
Um, er. Damn. Now I'm wondering how my leading and trailing
trimming works with Hebrew. How are the strings implemented
internally?
RTL (and bidi) languages are written in strings so that the character
order is the logical,
On Mon, Jan 12, 2009 at 9:01 AM, Ovid
publiustemp-perl6langua...@yahoo.comwrote:
- Original Message
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Alternatively, those could be ltrim() and rtrim(). If you need to
- Original Message
From: Larry Wall la...@wall.org
On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote:
: ...the trivial $string.trim and trim($string) case.
Hmm, I'd think .trim should work like .chomp, and return the trimmed
string without changing the original. You'd use
Ovid wrote:
$string.trim(:leading0);
$string.trim(:trailing0);
Setting leading or trailing to false (they default to true) would
result in either leading or trailing whitespace not being trimmed
Alternatively, those could be ltrim() and rtrim(). If you need to dynamically
determine
On Mon, Jan 12, 2009 at 07:01:25AM -0800, Ovid wrote:
I could optionally make the following work:
$string.trim(:leading0);
$string.trim(:trailing0);
Alternatively, those could be ltrim() and rtrim().
'left' and 'right' are probably not the right names for functions which
On Jan 12, 2009, at 11:27 AM, Carl Mäsak wrote:
How about .trim(:start) and .trim(:end)?
And .trim(:both) for orthogonality.
--
Andy Lester = a...@petdance.com = www.petdance.com = AIM:petdance
Carl Mäsak wrote:
Jonathan (), Ovid (), Larry ():
Can't say I really like the negated options though. They smell funny.
Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike.
Suggestions welcome as I can't think of anything better.
The .Net framework calls 'em TrimStart
On Mon, Jan 12, 2009 at 06:36:55PM +0100, Moritz Lenz wrote:
: Carl Mäsak wrote:
: Jonathan (), Ovid (), Larry ():
: Can't say I really like the negated options though. They smell funny.
:
: Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike.
: Suggestions welcome as I
On Mon, Jan 12, 2009 at 9:07 AM, jesse je...@fsck.com wrote:
'left' and 'right' are probably not the right names for functions which
trim leading and/or trailing space, since their meanings get somewhat
ambiguous if a language renders right-to-left instead of left-to-right
or vice-versa
Can I make a suggestion? From my point of view, it'd be nice if the
trim method supported:
- left/right (leftmost/rightmost part of the string; language-independent)
- start/end (start and end of string; could be leading/trailing instead)
- both
How would that work?
- Original Message
From: jason switzer jswit...@gmail.com
If we wanted language dependent version, use :leading, :trailing, and :both.
That will require each implementation properly handle the language
variations.
I think :start and :end are my favorites. Huffman++ (maybe :begin
On Mon, Jan 12, 2009 at 6:26 PM, Ovid
publiustemp-perl6langua...@yahoo.comwrote:
- Original Message
From: jason switzer jswit...@gmail.com
If we wanted language dependent version, use :leading, :trailing, and
:both.
That will require each implementation properly handle the
40 matches
Mail list logo