Edit question (was Re: string manipulation question)

Jean-Pierre A. Radley appl at jpr.com
Sun Dec 12 17:12:13 PST 2004


Ken Brody propounded (on Sun, Dec 12, 2004 at 07:34:22PM -0500):
| Tony Ryder wrote:
| [...]
| >     Why does the first edit (the one that expands the single quotes) need
| >     to have trailing spaces removed, while many of the edits in the global
| >     table do not, even though they add characters to the output?
| > 
| > Is it because the edit controls the whole entry of the field.
| 
| I'm not sure what you mean.  Don't all edits "control the while entry
| of the field"?
| 
| Why do the edits in the global edits table, such as "monexp":
| 
| monexp   monexp1 | monexp2 | monexp3
| monexp1  "Jan"<uary> | "Feb"<ruary> | "Mar"<ch> | "Apr"<il> | "May" | "Jun"<e>
| monexp2  "Jul"<y> | "Aug"<ust> | "Sep"<tember> | "Oct"<ober> | "Nov"<ember>
| monexp3  "Dec"<ember>
| 
| expand the incoming data, without stripping trailing spaces, while the
| edit I wrote to expand a single quote into two single quotes:
| 
|   { {!" "!}@ | "'"<"'"> | * }
| 
| will fail if you remove the "strip trailing spaces" -- {!" "!}@ -- part?
| 
| Mark already showed the reason for the failure:
| 
| > Field Length: 20 (pipe shows position right after end of the field)
| > 
| > that's all folks    |
| > that''s all folks    |  (overflow of 1)
| > 
| > Okay, so if you don't do a trim of the spaces, any trailing space might
| > overflow the field length, thus failing the edit?
| 
| So, the question is "why does this fail, while the others will not?"  After
| all, shouldn't monexp fail the same way?
| 
|     Jan      |
| becomes
|     January      |
| 
| Obviously, it doesn't fail that way.  Why does the "expand single quotes"
| edit fail this way, while all the others in the global edits table do not?
| 
| I can't imagine that Mark and Tony are the only ones interested in this.
| I'll post the answer at the end of tomorrow (Monday) if no one figures it
| out before then.

Because substituting the four characters
	"uary"
for the four characters
	"    "
does not change the length of the input string,
whereas substituting <two characters> for
<one character> expands the string length?

-- 
JP


More information about the Filepro-list mailing list