From: Duane Morin Date: 2006-11-21T05:27:57+09:00 Subject: Why is slice ignoring my fields at the end of the string? I'm not sure if this is a bug with the slice method, or if I'm just misunderstanding the logic behind it. If I have a string "1,2,3" that I slice into an array, I get 3 values. But if I have "1,2,3," with a trailing comma, I still get 3 -- even though I probably should have gotten 4, with 4 being an empty string. If I have "1,2,,3" then I will get 4 elements with the third one properly being an empty string. The trailing delimiter problem seems to repeat -- if I have "1,2,3,,," then I still end up with an array of just 3 elements. All of ones on the end are gone. Anybody know if this is the intended behavior, and if so, why? I'd think that if I'm saying delimit fields on this character, then it would be up to me to decide whether or not to keep the empties. Maybe there's a way to call split with a flag that says to keep the empties, I'm not sure. That just occurred to me, gonna go look into that. D -- Posted via http://www.ruby-forum.com/.