This patch implements the .trim() method for strings.

Two problems:

1.  I don't like the double-negative, but I was unsure how to get rid of it.

  unless not_whitespace goto done

2.  I don't like the magic number '32

  not_whitespace = is_cclass 32, s, start

 
$I0 = is_cclass .CCLASS_WHITESPACE, target, pos

I was getting an 'unknown parrot op' or something like that (too tired to 
recompile and find out the exact error message).  I can't figure out how to get 
parrot to recognize that.

Many thanks to moritz++ for handholding on IRC.

Oh, there are no tests because I couldn't find any pugs tests for this :( 
What's the appropriate procedure for this?

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Attachment: trim.patch
Description: Binary data

Reply via email to