2 msgRe: Rails gem site seems borked.

Check if char in string?
\ globalrev (7 May 2008)
. \ Marc Heiler (7 May 2008)
. \ Stefano Crocco (7 May 2008)
. . \ Sandro Paganotti (7 May 2008)
. \ globalrev (7 May 2008)
. \ (matt neuburg) (7 May 2008)
. \ globalrev (7 May 2008)
. . \ Joel VanderWerf (7 May 2008)
. . \ Daniel Finnie (7 May 2008)
. . \ Todd Benson (7 May 2008)
. \ (matt neuburg) (7 May 2008)
. \ RedWiz (7 May 2008)
. \ globalrev (7 May 2008)
. . \ Joel VanderWerf (7 May 2008)
. . \ Tim Hunter (7 May 2008)
. . . \ Todd Benson (7 May 2008)
. . . . \ Todd Benson (7 May 2008)
. \ globalrev (8 May 2008)
. . \ Heesob Park (8 May 2008)
. . \ Robert Dober (8 May 2008)
. \ Jim Cochrane (8 May 2008)
. . \ Colin Bartlett (8 May 2008)
. \ Ashutosh (8 May 2008)
. \ globalrev (8 May 2008)
. . \ Heesob Park (8 May 2008)
. . . \ Todd Benson (8 May 2008)
. \ globalrev (8 May 2008)
. . \ Adam Shelly (8 May 2008)
. . \ Todd Benson (8 May 2008)
. \ globalrev (9 May 2008)
. . \ Heesob Park (9 May 2008)

7 msgGetting pipe return codes from SYSTEM command
2 msgproblem cross compiling ruby 1.9
1 msgHelp with net-ssh 2.0
19 msgWord for monkeypatching
16 msgchanging hash key
8 msgCode for connecting to SQL Server?
6 msgidiom for Hash like map...
22 msgPosting Culture
6 msgInteresting result of a newbie mistake
4 msgsax parsing
1 msg[ANN] London Ruby User Group - 12th May 2008
2 msgtimestamp
1 msgCisco Wants You Back!
1 msgHow to use to_yaml_style?
6 msgWhere to start if I want to print to
5 msgCreate a new file name by appending timestamp t...
3 msgflexmock not working in cygwin
2 msgPlain english to condition??
Subject:Re: Check if char in string?
Group:Ruby-talk
From:Heesob Park
Date:9 May 2008


 
Hi,

globalrev wrote:
> On 8 Maj, 21:26, Adam Shelly <adam.she...> wrote:
>> [aeiou] will match a vowel ... addition, you can use the abbreviations
>> \s #whitespace
>>
>> > str = str.gsub(/([^\aeiouy])/,"\\1o\\1")
>>
>> I'd modify it to deal with case:
>> str.gsub(/([^\saeiouy])/i){|c|"#{c}o#{c.downcase}"}
>>
>> will encode "Hi Oliver" into
>> "Hohi Ololivoveror", instead of
>> "HoHi OoOlolivoveror"
>>
>> HTH,
>> -Adam
>
> is there some equally clever way to replace decode?
>
> puts "Enter code to decrypt: "
> code = gets
> x = 0
> dec = ""
> while (x<code.length())
> dec = dec + code[x].chr
> if code[x].chr !~ /[\saeiouy]/
> x = x + 2
> end
> x = x + 1
> end
> print dec
Something like this:
code.gsub(/([^\saeiouy])o([^\saeiouy])/){$1==$2 ? $1 : $& }

Regards,

Park Heesob
--
Posted via http://www.ruby-forum.com/.



© 2004-2008 readlist.com