[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: string indexing/setting

Simon Kröger

9/29/2006 9:06:00 PM

Steven Ketcham wrote:
> I think I found a version difference between 1.82 and 1.84-20 Stable and I
> wanted to know what correct code was and what was not.
>
> pos = s.index("11")

what is 's' here?

> s = "000011481^3"
>
> s[2..pos] = "BigString"
>
> puts s


cheers

Simon

1 Answer

Steven Ketcham

9/29/2006 9:11:00 PM

0

Sorry! Wrong order in the copy-and-paste.


s = "000011481^3"
pos = s.index("11")
s[2..pos] = "BigString"

puts s



Thanks!



Steve






-----Original Message-----
From: Simon Kröger [mailto:SimonKroeger@gmx.de]
Sent: Friday, September 29, 2006 5:06 PM
To: ruby-talk ML
Subject: Re: string indexing/setting

Steven Ketcham wrote:
> I think I found a version difference between 1.82 and 1.84-20 Stable and I
> wanted to know what correct code was and what was not.
>
> pos = s.index("11")

what is 's' here?

> s = "000011481^3"
>
> s[2..pos] = "BigString"
>
> puts s


cheers

Simon