Shorten string

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Shorten string

Mathieu SUEN
Hi,

Is they a way to shorten string in a way that i still understandable  
but more compacte?
For exemple something  that remove all the vowel.

Thanks

        Math

Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

Benoit St-Jean
Try this:

'vowels' reject: [:e | 'aeiouy' includes: e]

 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
Blog: lamneth.wordpress.com
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)

----- Original Message ----
From: Mathieu Suen <[hidden email]>
To: The general-purpose Squeak developers list <[hidden email]>
Sent: Thursday, March 1, 2007 9:51:48 AM
Subject: Shorten string

Hi,

Is they a way to shorten string in a way that i still understandable  
but more compacte?
For exemple something  that remove all the vowel.

Thanks

    Math





Reply | Threaded
Open this post in threaded view
|

RE: Shorten string

Ron Teitelbaum
'vowels' copyWithoutAll: 'aeiou' copy.

'vowels' select: [:aCharacter | aCharacter isVowel not].

aStream := 'vowels' copy readStream.
result := WriteStream on: String new.
[aStream atEnd] whileFalse: [
        nextCharacter := aStream next.
        nextCharacter isVowel
        ifFalse: [
                result nextPut: nextCharacter.
        ]
].
aStream
^result contents

Ron Teitelbaum

> From: Benoit St-Jean
> Sent: Thursday, March 01, 2007 9:58 AM
>
> Try this:
>
> 'vowels' reject: [:e | 'aeiouy' includes: e]
>
>
> -----------------
> Benoit St-Jean
> Yahoo! Messenger: bstjean
> Blog: lamneth.wordpress.com
> A standpoint is an intellectual horizon of radius zero.
> (Albert Einstein)
>
> ----- Original Message ----
> From: Mathieu Suen <[hidden email]>
> To: The general-purpose Squeak developers list <squeak-
> [hidden email]>
> Sent: Thursday, March 1, 2007 9:51:48 AM
> Subject: Shorten string
>
> Hi,
>
> Is they a way to shorten string in a way that i still understandable
> but more compacte?
> For exemple something  that remove all the vowel.
>
> Thanks
>
>     Math
>
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Shorten string

Klaus D. Witzel
In reply to this post by Mathieu SUEN
Hi Math,

on Thu, 01 Mar 2007 15:51:48 +0100, you wrote:

> Hi,
>
> Is they a way to shorten string in a way that i still understandable but  
> more compacte?
> For exemple something  that remove all the vowel.

   'your string' reject: [:char | char isVowel]

/Klaus

> Thanks
>
> Math
>
>



Reply | Threaded
Open this post in threaded view
|

RE: Shorten string

J J-6
In reply to this post by Ron Teitelbaum
>From: "Ron Teitelbaum" <[hidden email]>
>Reply-To: [hidden email], The general-purpose Squeak developers
>list<[hidden email]>
>To: "'The general-purpose Squeak developers
>list'"<[hidden email]>
>Subject: RE: Shorten string
>Date: Thu, 1 Mar 2007 10:41:02 -0500
>
>'vowels' copyWithoutAll: 'aeiou' copy.

What is that copy message for?  I think you are a bit paranoid, no?

_________________________________________________________________
Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a month.
Intro*Terms  
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f6&disc=y&vers=743&s=4056&p=5117


Reply | Threaded
Open this post in threaded view
|

RE: Shorten string

Ron Teitelbaum
> -----Original Message-----
> From: J J
> Sent: Thursday, March 01, 2007 3:56 PM
>
> >From: "Ron Teitelbaum" <[hidden email]>
> >
> >'vowels' copyWithoutAll: 'aeiou' copy.
>
> What is that copy message for?  I think you are a bit paranoid, no?
>


Paranoid?  Yes!!

(Actually it's a very subtle joke from a previous thread about compiled
literals)

Ron Teitelbaum