From: Ron Jeffries Date: 2002-03-04T09:37:13+09:00 Subject: Re: string to array and back On Sun, 03 Mar 2002 21:47:59 GMT, "Hal E. Fulton" wrote: >I suggest you split on a null string. Won't this work? > > str = "ABC" > arr = str.split("") # ["A","B","C"] I could do that and it might be just the thing. I'm not clear how I'll get them back together. Maybe if I build them up element at a time with << I can mostly not worry whether I have an array or a string. I hadn't thought of converting my strings to arrays of character, that /might/ be an interesting direction. > >As an aside: There is a kind of logic to the line-orientedness >of strings, esp. when you stop to think of a file as a single >multi-line string. I've gotten so used to it, it doesn't bother me >anymore. Yes, I love it normally. But each_line makes as much sense and would preserve each to work more consistently. I think it's a lump. > >Much the same with the byte vs. single-char-string situation. >I can't remember the rationale for it, though I've heard one. :) >And again, I've just gotten used to it. Yes, we can get used to anything. I'm not sure that's good: I think C++ came out of that kind of thinking ... ;-> Thanks for the ideas ... Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com I'm giving the best advice I have. You get to decide whether it's true for you.