[DGD] sscanf
David Jackson
araborn at home.com
Fri Dec 7 02:01:07 CET 2001
Yeah, but with a do-while loop you can call other functions to do further
processing...
David
At 10:45 AM 12/6/2001 -0800, you wrote:
>string *arr;
>
>arr = explode(source, " ");
>
>That should break the sentence into an array of words.
>
>~jason
>
>--- David Jackson <araborn at home.com> wrote:
> >
> > This behavior makes it easy to have a do-while loop
> > quickly break a
> > sentence down into words.
> >
> > -D
> >
> >
> > At 09:51 PM 12/4/2001 -0600, you wrote:
> > >On Tue, Dec 04, 2001 at 07:36:22PM -0800, Chooser
> > Fireman wrote:
> > > > Question on sscanf ... how can I do:
> > > >
> > > > if (sscanf(sInput, "%s %s", sParam1, sParam2)
> > > >
> > > > and allow for sParam2 to be more than 1 word and
> > even a sentence?
> > >
> > >That's the default behaviour of DGD, as opposed to
> > the C *scanf()
> > >behaviour:
> > >
> > > void
> > > process_input(string line)
> > > {
> > > string verb, rest;
> > >
> > > if (sscanf(line, "%s %s", verb, rest) < 2)
> > {
> > > verb = line;
> > > rest = nil;
> > > }
> > > /* ... */
> > > }
> > >
> > >This will split up a line like 'put foo in bar'
> > into 'put' and
> > >'foo and bar' or a line like 'smile' into 'smile'
> > and nil.
> > >
> > >Erwin.
> > >--
> > >Erwin Harte <harte at xs4all.nl>
> >
> >_________________________________________________________________
> > >List config page:
> > http://list.imaginary.com/mailman/listinfo/dgd
> >
> >
>_________________________________________________________________
> > List config page:
>http://list.imaginary.com/mailman/listinfo/dgd
>
>
>__________________________________________________
>Do You Yahoo!?
>Send your FREE holiday greetings online!
>http://greetings.yahoo.com
>_________________________________________________________________
>List config page: http://list.imaginary.com/mailman/listinfo/dgd
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list