HP3000-L Archives

October 1998, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Glenn Cole <[log in to unmask]>
Reply To:
Date:
Sat, 17 Oct 1998 13:19:20 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (46 lines)
D-oh!  Late Friday is probably not a good time for hasty conclusions. :/
(Not that any other time is much better....)

I wrote that parsing

>         john,brown,ca,95014

with

>         setvar  first_name      word( line,,1,x)
>         setvar  last_name       word( line,,1,x,x )
>         setvar  state           word( line,,1,x,x )
>         setvar  zip             word( line,,1,x,x )

worked.  It doesn't, as was pointed out to me in a private email.

What happened was that I parsed

          setvar  line  "this is a test"

with the above word() expressions and THAT worked, but only because
leading spaces are skipped while other leading delimiters are not.
(The space between "this" and "is" becomes a "leading" space for
the second invocation of word() in the code above.)

So, in the example shown, 'x' never gets beyond the first comma,
and all fields after 'first_name' are set to the empty string "".

The following works fine:

>       setvar  first_name      word( line,,1,x)
>       setvar  last_name       word( line,,1,x,x+1 )
>       setvar  state           word( line,,1,x,x+1 )
>       setvar  zip             word( line,,1,x,x+1 )

Many thanks to Jeff "The Man" Vance for bringing this to my attention. :)

--Glenn "hip deep in CI functions and on-the-fly command files" Cole
  Software al dente, Inc.
  [log in to unmask]


.......................................................................

Item Subject: cc:Mail Text

ATOM RSS1 RSS2