From: dblack@... Date: 2003-08-25T20:03:19+09:00 Subject: Re: Wierd problem reading fields in a tab-delimitted row... Hi -- On Mon, 25 Aug 2003, Kurt Euler wrote: > David- > > Thanks very much for your comments. -1 does indeed make a more > promising result. I'm 1/2 way home on this problem... > > A follow-up question if I may: How can I modify the if statement so > that the output returns "no_string" if the string is blank. Test > somehow for length = 0? Can you suggest the syntax? There are a few ways -- the first is probably the nicest: str.empty? str == "" str.size.zero? and others. But I think you're already doing what you're asking how to do: > > if field[4] != "" > > puts "some_string" > > puts field[4] > > else > > puts "no_string" > > puts field[4] > > end If field[4] is empty (""), the 'else' is executed and "no_string" is printed. As I mentioned before, this might be a bit misleading, since an empty string is different from no string (such as nil). David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav