From: Eric Hodel Date: 2003-02-13T03:30:27+09:00 Subject: Re: String frustration --WRT3RXLOp/bBMgTI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Tim Kynerd (tim@tram.nu) wrote: > On Wed, 12 Feb 2003 14:16:03 +0900, Harry Ohlsen wrote: >=20 > Although I think I understand what's going on here, it leaves me wondering > what would be a better way to do what I need to do, if there is a better > way. >=20 > The input file contains three tab-separated fields. The second field needs > to be able to contain an arbitrary number of newlines (which will be > realized as actual newlines, so to speak, when this field is later printed > out). >=20 > The only alternative I can see (to including them as "\n" in the second > field) is to actually put the newlines into the file as newlines, so to > speak, and specify a different string as the record separator (say, > an uncommon character followed by a newline). However, this obviously > makes the file rather difficult to create in a text editor, and to read. >=20 > Then, since there happen to be exactly three fields in each line, there's > the idea of tab-separating the "pieces" of the second field, then reading > everything in, taking the first and last fields as the first and third, > and interpreting everything in between as the second field. This would > work, but I don't like it because it depends crucially on the fact that > there are exactly three fields per line (and that may not remain true as I > continue to play with this program I'm writing). >=20 > Any other ideas? YAML - http://raa.ruby-lang.org/list.rhtml?name=3Dyaml --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --WRT3RXLOp/bBMgTI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+SpLAMypVHHlsnwQRAptbAKCZTYqd4aUtA86D5LdjD5q5T/icRQCeM4iX ye3Qzd4UVDhimAtejwdFjkA= =9QuN -----END PGP SIGNATURE----- --WRT3RXLOp/bBMgTI--