Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Counting a string

11 views
Skip to first unread message

Benedikt Müller

unread,
Feb 26, 2010, 8:30:19 AM2/26/10
to
Hi
I want to „count“ a string. I don't know, how to express it better,
because of that I'll try to explain it. I have a string, say 'a'. Now
I want to increase it, so it would be 'b'. I increase it again, it
would be 'c' and so on.
Is there a method for this task?

--
Gruß, Benedikt

Alexander Jesner

unread,
Feb 26, 2010, 8:33:35 AM2/26/10
to

Try:

"a".succ
=> "b"

Regards

Wybo Dekker

unread,
Feb 26, 2010, 8:34:52 AM2/26/10
to
>irb
>> x='a'
=> "a"
>> x.next!
=> "b"
>> x.next!
=> "c"
>> x.next!
=> "d"
>> x.next!
=> "e"
>> x.next!
=> "f"

--
Wybo

Benedikt Müller

unread,
Feb 26, 2010, 8:37:18 AM2/26/10
to
thx
Sorry I looked in ruby-doc in the String class but I didn't saw it so
I thought that isn't in the standard lib.
:(

--
Gruß, Benedikt

Benedikt Müller

unread,
Feb 26, 2010, 9:46:09 AM2/26/10
to
Is there a possibility to say what chars can be in the string? I want
to have upper chars and lower chars but i want to start with only one
char.

--
Gruß, Benedikt

0 new messages