You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2011/03/12 13:57:17 UTC

Just a stab in the dark

Hi List

this is a bit OT but it's the weekend and I have a question which I am 
desperate to answer and my googling skills are no match for it.

Does anyone know where I can get a Java implementation of scanf?


I want to do C-style scanf and read a string into a list of parameters - 
the exact corollary of printf, rather than the slightly lame 
implementation java.util.Scanner which won't automatically read a whole 
set of values of different types into the same types that printf can 
handle, e.g. Calendar and Date.

e.g. I can do this for formatting:

System.out.format("Local time: %tT", Calendar.getInstance());


but not for parsing.

Yours thro the google haze,

Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Martin Gainty on 14/03/11 11:25, wrote:
>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>> desperate to answer and my googling skills are no match for it.
>>>>
>>>> Does anyone know where I can get a Java implementation of scanf?
>>> Does java.text.MessageFormat.parse() perhaps meet at least some of your
>>> needs?
>> This might actually be a quicker way to do exactly what I need to do now, I mean 
>> quicker than Scanner. Thanks for the great tip.
>>
>> However it has 2 drawbacks in comparison with C's scanf - it doesn't take the 
>> same symbols and formatting in its pattern as printf, and it can't handle 
>> multiple occurrences of the same variable in the pattern.
>>
> MG>Another great solution!
> MG>does anyone know how to get scanf source from either Sun Microsystems or *cough* microsoft so we can refactor scanf to java?


scanf source from Sun or Microsoft? Don't you mean GNU or some other open source 
  C implementation?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Just a stab in the dark

Posted by Martin Gainty <mg...@hotmail.com>.
MG>Matt and Adam

> Subject: Re: Just a stab in the dark
> 
> Matt Meola on 14/03/11 00:04, wrote:
> > On 03/12/2011 05:57 AM, Adam Hardy wrote:
> >> Hi List
> >>
> >> this is a bit OT but it's the weekend and I have a question which I am
> >> desperate to answer and my googling skills are no match for it.
> >>
> >> Does anyone know where I can get a Java implementation of scanf?
> > 
> > Does java.text.MessageFormat.parse() perhaps meet at least some of your
> > needs?
> 
> This might actually be a quicker way to do exactly what I need to do now, I mean 
> quicker than Scanner. Thanks for the great tip.
> 
> However it has 2 drawbacks in comparison with C's scanf - it doesn't take the 
> same symbols and formatting in its pattern as printf, and it can't handle 
> multiple occurrences of the same variable in the pattern.
> 
> Regards
> Adam
>
MG>Another great solution!
MG>does anyone know how to get scanf source from either Sun Microsystems or *cough* microsoft so we can refactor scanf to java?

 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: [OT] Re: Just a stab in the dark

Posted by Alex Lopez <al...@flordeutopia.pt>.
I think they ment DSL as in Domain Specific Language

Em 14-03-2011 14:06, Brian Thompson escreveu:
> On Mon, Mar 14, 2011 at 7:29 AM, Dave Newton<da...@gmail.com>  wrote:
>
>> On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
>>> But for the future I am writing an app where the user can upload a file
>> of
>>> data and specify the input using that printf/scanf pattern description,
>> and
>>> output the same data into new file with a new format according to a
>> secocnd
>>> pattern. It's OHLC historical data from the financial markets, and it
>> must
>>> be in the correct format for importing into various different analysis
>>> programs.
>>
>> DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
>> financial data, in clojure) to generate all the Java APIs needed to
>> consume/write the data files.
>>
>
>
> For the sake of us poor, clueless lurkers, would you mind defining DSL in
> this context?  All I can think of is DSL as in Internet service, but I can
> tell from context that it's not the right definition.
>
> Brian
>
>
>
>>
>> Groovy or JRuby might be a better choice depending on how averse you
>> are to toenail-based languages, but this is precisely the kind of
>> thing DSLs are good for, and it's a lot easier to remember a
>> human-readable DSL than the scanf spec, and it'd be easier to add
>> domain-specific data types.
>>
>> Dave
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Just a stab in the dark

Posted by Brian Thompson <el...@gmail.com>.
On Mon, Mar 14, 2011 at 7:29 AM, Dave Newton <da...@gmail.com> wrote:

> On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
> > But for the future I am writing an app where the user can upload a file
> of
> > data and specify the input using that printf/scanf pattern description,
> and
> > output the same data into new file with a new format according to a
> secocnd
> > pattern. It's OHLC historical data from the financial markets, and it
> must
> > be in the correct format for importing into various different analysis
> > programs.
>
> DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
> financial data, in clojure) to generate all the Java APIs needed to
> consume/write the data files.
>


For the sake of us poor, clueless lurkers, would you mind defining DSL in
this context?  All I can think of is DSL as in Internet service, but I can
tell from context that it's not the right definition.

Brian



>
> Groovy or JRuby might be a better choice depending on how averse you
> are to toenail-based languages, but this is precisely the kind of
> thing DSLs are good for, and it's a lot easier to remember a
> human-readable DSL than the scanf spec, and it'd be easier to add
> domain-specific data types.
>
> Dave
>
>

Re: [OT] Re: Just a stab in the dark

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 14, 2011 at 8:07 AM, Adam Hardy wrote:
> But for the future I am writing an app where the user can upload a file of
> data and specify the input using that printf/scanf pattern description, and
> output the same data into new file with a new format according to a secocnd
> pattern. It's OHLC historical data from the financial markets, and it must
> be in the correct format for importing into various different analysis
> programs.

DSL. In fact a guy at the Clojure NYC meetup did this exact thing (for
financial data, in clojure) to generate all the Java APIs needed to
consume/write the data files.

Groovy or JRuby might be a better choice depending on how averse you
are to toenail-based languages, but this is precisely the kind of
thing DSLs are good for, and it's a lot easier to remember a
human-readable DSL than the scanf spec, and it'd be easier to add
domain-specific data types.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
A micro-DSL ? I should know this stuff, I think my brain is going. What's DSL in 
this context?

Re: needing all of scanf: not right now I don't need it. I actually need 
anything like last week already - spent too long staring at tv scenes of 
exploding nuclear reactors and wasteland where towns used to be over the weekend.

But for the future I am writing an app where the user can upload a file of data 
and specify the input using that printf/scanf pattern description, and output 
the same data into new file with a new format according to a secocnd pattern. 
It's OHLC historical data from the financial markets, and it must be in the 
correct format for importing into various different analysis programs.



Dave Newton on 14/03/11 11:22, wrote:
> Do you really need all of scanf's functionality?
> 
> If I were approaching this I'd probably consider writing some sort of
> transform between scanf functionality and an underlying
> implementation; a micro-DSL, more or less.
> 
> Dave
> 
> On Mon, Mar 14, 2011 at 7:15 AM, Adam Hardy
> <ah...@cyberspaceroad.com> wrote:
>> Matt Meola on 14/03/11 00:04, wrote:
>>> On 03/12/2011 05:57 AM, Adam Hardy wrote:
>>>> Hi List
>>>>
>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>> desperate to answer and my googling skills are no match for it.
>>>>
>>>> Does anyone know where I can get a Java implementation of scanf?
>>> Does java.text.MessageFormat.parse() perhaps meet at least some of your
>>> needs?
>> This might actually be a quicker way to do exactly what I need to do now, I
>> mean quicker than Scanner. Thanks for the great tip.
>>
>> However it has 2 drawbacks in comparison with C's scanf - it doesn't take
>> the same symbols and formatting in its pattern as printf, and it can't
>> handle multiple occurrences of the same variable in the pattern.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: Just a stab in the dark

Posted by Dave Newton <da...@gmail.com>.
Do you really need all of scanf's functionality?

If I were approaching this I'd probably consider writing some sort of
transform between scanf functionality and an underlying
implementation; a micro-DSL, more or less.

Dave

On Mon, Mar 14, 2011 at 7:15 AM, Adam Hardy
<ah...@cyberspaceroad.com> wrote:
> Matt Meola on 14/03/11 00:04, wrote:
>>
>> On 03/12/2011 05:57 AM, Adam Hardy wrote:
>>>
>>> Hi List
>>>
>>> this is a bit OT but it's the weekend and I have a question which I am
>>> desperate to answer and my googling skills are no match for it.
>>>
>>> Does anyone know where I can get a Java implementation of scanf?
>>
>> Does java.text.MessageFormat.parse() perhaps meet at least some of your
>> needs?
>
> This might actually be a quicker way to do exactly what I need to do now, I
> mean quicker than Scanner. Thanks for the great tip.
>
> However it has 2 drawbacks in comparison with C's scanf - it doesn't take
> the same symbols and formatting in its pattern as printf, and it can't
> handle multiple occurrences of the same variable in the pattern.
>
> Regards
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Matt Meola on 14/03/11 00:04, wrote:
> On 03/12/2011 05:57 AM, Adam Hardy wrote:
>> Hi List
>>
>> this is a bit OT but it's the weekend and I have a question which I am
>> desperate to answer and my googling skills are no match for it.
>>
>> Does anyone know where I can get a Java implementation of scanf?
> 
> Does java.text.MessageFormat.parse() perhaps meet at least some of your
> needs?

This might actually be a quicker way to do exactly what I need to do now, I mean 
quicker than Scanner. Thanks for the great tip.

However it has 2 drawbacks in comparison with C's scanf - it doesn't take the 
same symbols and formatting in its pattern as printf, and it can't handle 
multiple occurrences of the same variable in the pattern.

Regards
Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Just a stab in the dark

Posted by Matt Meola <ma...@gmail.com>.
On 03/12/2011 05:57 AM, Adam Hardy wrote:
> Hi List
>
> this is a bit OT but it's the weekend and I have a question which I am
> desperate to answer and my googling skills are no match for it.
>
> Does anyone know where I can get a Java implementation of scanf?

Does java.text.MessageFormat.parse() perhaps meet at least some of your
needs?


-- 
Matt Meola


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: RE: Just a stab in the dark

Posted by Maurizio Cucchiara <ma...@gmail.com>.
I'm sorry Martin if I gave you that kind of impression, but I never thought,
and moreover never said, that my idea is better than someone else's.
I only said that a scanf implementation would be hard to realize due to
immutability matter and so, only for the sake of curiosity, I asked the OP
why he prefered scanf vs Scanner class.

Maurizio Cucchiara

Il giorno 13/mar/2011 23.35, "Martin Gainty" <mg...@hotmail.com> ha
scritto:

Maurizio (et al)

there is no scanf functionality currently available in any of the Java
Libraries

Scanner methods comes close to implementing scanf
but so does tokenizing an array of String constructors to append to
StringBuffer
either way *will probably work*

Nota Bene:
if you're suggesting your way is better than someone elses be prepared for
the opportunity to prove what you originally promised
thats the reason why i suggested IF you have a better way to implement scanf
method..go ahead ...and code the method
and display the code to the dev list so the rest of us so we can *learn* the
implementation.


Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note ...
> Date: Sun, 13 Mar 2011 19:00:25 +0100
> Subject: Re: Just a stab in the dark

> From: maurizio.cucchiara@gmail.com
> To: user@struts.apache.org
> CC: ahardy.struts@cyberspaceroad.com

>
> I'm sorry, but unfortunately I have any implementation and to be
> frankly I don't understand w...

RE: Just a stab in the dark

Posted by Martin Gainty <mg...@hotmail.com>.
Maurizio (et al)

there is no scanf functionality currently available in any of the Java Libraries

Scanner methods comes close to implementing scanf 
but so does tokenizing an array of String constructors to append to StringBuffer
either way *will probably work*

Nota Bene:
if you're suggesting your way is better than someone elses be prepared for the opportunity to prove what you originally promised
thats the reason why i suggested IF you have a better way to implement scanf method..go ahead ...and code the method
and display the code to the dev list so the rest of us so we can *learn* the implementation.

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sun, 13 Mar 2011 19:00:25 +0100
> Subject: Re: Just a stab in the dark
> From: maurizio.cucchiara@gmail.com
> To: user@struts.apache.org
> CC: ahardy.struts@cyberspaceroad.com
> 
> I'm sorry, but unfortunately I have any implementation and to be
> frankly I don't understand why Marting thought so :).
> Adam, again, why do you prefer scanf to scanner?
> 
> 
> On 13 March 2011 15:53, Adam Hardy <ah...@cyberspaceroad.com> wrote:
> > I actually hoped I would find it in commons lang already - I was only asking
> > on the struts list because I know the user list here is so much more diverse
> > and would more likely know if it existed already somewhere.
> >
> > Do you Maurizio already have a scanf implementation? Or am I misinterpreting
> > Martin's message to you?
> >
> > I should think it's about a day's work, with tests, plus a bit of thought
> > needs to go into the design to make the parsing of the pattern string
> > cacheable. That's why I was hoping to avoid writing scanf from scratch. But
> > it looks like I'll have to make do with a temporary fix using Scanner on
> > just the bits I need right now.
> >
> > Maurizio Cucchiara on 13/03/11 09:52, wrote:
> >>
> >> I think that the right place for this kind of questions is apache commons
> >> lang ml.
> >>
> >> Maurizio Cucchiara
> >>
> >> Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha
> >> scritto:
> >>>
> >>> you can use String constructor to construct what you need from any part
> >>> of a previous String
> >>> then use StringBuffer to concat the Strings together
> >>> but Scanner will work too.
> >>>
> >>> Maurizio can you put a scanf method in StringTools that uses scanner to
> >>
> >> replicate scanf functionality and send it to dev@struts.apache.org?
> >>>
> >>> thanks,
> >>> Martin
> >>>
> >>>
> >>>> Date: Sat, 12 Mar 2011 17:16:44 +0100
> >>>> Subject: Re: RE: Just a stab in the dark
> >>>> From: maurizio.cucchiara@gmail.com
> >>>> To: user@struts.apache.org
> >>>>
> >>>> Why do you prefer scanf to scanner class?
> >>>> I could be wrong, but I don't believe it is possible cause of the
> >>>> immutability of the string class (you cannot pass a string object as
> >>>> reference).
> >>>>
> >>>> Maurizio Cucchiara
> >>>>
> >>>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
> >>>> scritto:
> >>>>
> >>>> havent seen scanf method in any of the Java classes
> >>>> i welcome factoring a scanf method in
> >>>> org.apache.struts2.convention.StringTools
> >>>>
> >>>> anyone ?
> >>>> Martin
> >>>>
> >>>>
> >>>>> Date: Sat, 12 Mar 2011 12:57:17 +0000
> >>>>> From: ahardy.struts@cyberspaceroad.com
> >>>>> To: user@struts.apache.org
> >>>>> Subject: Just a stab in the dark
> >>>>> Hi List
> >>>>>
> >>>>> this is a bit OT but it's the weekend and I have a question which I am
> >>>>> desperat...
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> 
> 
> -- 
> Maurizio Cucchiara
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

RE: Just a stab in the dark

Posted by Martin Gainty <mg...@hotmail.com>.
> Subject: Re: Just a stab in the dark
> 
> Oh I see. No problem.
> 
> re scanf vs scanner: scanf takes a pattern, an input string of values in format 
> of pattern, and an array of reference variables. It parses the input string 
> according to the pattern (using all the same types and qualifications as printf) 
> and puts the resulting values in the variables.

MG>so it looks as if the developer would need to implement scanf pattern in order to convert input string appropriately?
> 
> scanner merely tokenizes the input string according to a given separator 
> character and knows nothing about class types - only primitives.

MG>the classes could be 'autoboxed' later on class Integer for primitive type int and so on..?
MG>interesting task..any takers?? 
http://download.oracle.com/javase/1.5.0/docs/guide/language/autoboxing.html

> 
> 
> 
> Maurizio Cucchiara on 13/03/11 18:00, wrote:
> > I'm sorry, but unfortunately I have any implementation and to be
> > frankly I don't understand why Marting thought so :).
> > Adam, again, why do you prefer scanf to scanner?
> > 
> > 
> > On 13 March 2011 15:53, Adam Hardy <ah...@cyberspaceroad.com> wrote:
> >> I actually hoped I would find it in commons lang already - I was only asking
> >> on the struts list because I know the user list here is so much more diverse
> >> and would more likely know if it existed already somewhere.
> >>
> >> Do you Maurizio already have a scanf implementation? Or am I misinterpreting
> >> Martin's message to you?
> >>
> >> I should think it's about a day's work, with tests, plus a bit of thought
> >> needs to go into the design to make the parsing of the pattern string
> >> cacheable. That's why I was hoping to avoid writing scanf from scratch. But
> >> it looks like I'll have to make do with a temporary fix using Scanner on
> >> just the bits I need right now.
> >>
> >> Maurizio Cucchiara on 13/03/11 09:52, wrote:
> >>> I think that the right place for this kind of questions is apache commons
> >>> lang ml.
> >>>
> >>> Maurizio Cucchiara
> >>>
> >>> Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha
> >>> scritto:
> >>>> you can use String constructor to construct what you need from any part
> >>>> of a previous String
> >>>> then use StringBuffer to concat the Strings together
> >>>> but Scanner will work too.
> >>>>
> >>>> Maurizio can you put a scanf method in StringTools that uses scanner to
> >>> replicate scanf functionality and send it to dev@struts.apache.org?
> >>>> thanks,
> >>>> Martin
> >>>>
> >>>>
> >>>>> Date: Sat, 12 Mar 2011 17:16:44 +0100
> >>>>> Subject: Re: RE: Just a stab in the dark
> >>>>> From: maurizio.cucchiara@gmail.com
> >>>>> To: user@struts.apache.org
> >>>>>
> >>>>> Why do you prefer scanf to scanner class?
> >>>>> I could be wrong, but I don't believe it is possible cause of the
> >>>>> immutability of the string class (you cannot pass a string object as
> >>>>> reference).
> >>>>>
> >>>>> Maurizio Cucchiara
> >>>>>
> >>>>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
> >>>>> scritto:
> >>>>>
> >>>>> havent seen scanf method in any of the Java classes
> >>>>> i welcome factoring a scanf method in
> >>>>> org.apache.struts2.convention.StringTools
> >>>>>
> >>>>> anyone ?
> >>>>> Martin
> >>>>>
> >>>>>
> >>>>>> Date: Sat, 12 Mar 2011 12:57:17 +0000
> >>>>>> From: ahardy.struts@cyberspaceroad.com
> >>>>>> To: user@struts.apache.org
> >>>>>> Subject: Just a stab in the dark
> >>>>>> Hi List
> >>>>>>
> >>>>>> this is a bit OT but it's the weekend and I have a question which I am
> >>>>>> desperat...
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Oh I see. No problem.

re scanf vs scanner: scanf takes a pattern, an input string of values in format 
of pattern, and an array of reference variables. It parses the input string 
according to the pattern (using all the same types and qualifications as printf) 
and puts the resulting values in the variables.

scanner merely tokenizes the input string according to a given separator 
character and knows nothing about class types - only primitives.



Maurizio Cucchiara on 13/03/11 18:00, wrote:
> I'm sorry, but unfortunately I have any implementation and to be
> frankly I don't understand why Marting thought so :).
> Adam, again, why do you prefer scanf to scanner?
> 
> 
> On 13 March 2011 15:53, Adam Hardy <ah...@cyberspaceroad.com> wrote:
>> I actually hoped I would find it in commons lang already - I was only asking
>> on the struts list because I know the user list here is so much more diverse
>> and would more likely know if it existed already somewhere.
>>
>> Do you Maurizio already have a scanf implementation? Or am I misinterpreting
>> Martin's message to you?
>>
>> I should think it's about a day's work, with tests, plus a bit of thought
>> needs to go into the design to make the parsing of the pattern string
>> cacheable. That's why I was hoping to avoid writing scanf from scratch. But
>> it looks like I'll have to make do with a temporary fix using Scanner on
>> just the bits I need right now.
>>
>> Maurizio Cucchiara on 13/03/11 09:52, wrote:
>>> I think that the right place for this kind of questions is apache commons
>>> lang ml.
>>>
>>> Maurizio Cucchiara
>>>
>>> Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha
>>> scritto:
>>>> you can use String constructor to construct what you need from any part
>>>> of a previous String
>>>> then use StringBuffer to concat the Strings together
>>>> but Scanner will work too.
>>>>
>>>> Maurizio can you put a scanf method in StringTools that uses scanner to
>>> replicate scanf functionality and send it to dev@struts.apache.org?
>>>> thanks,
>>>> Martin
>>>>
>>>>
>>>>> Date: Sat, 12 Mar 2011 17:16:44 +0100
>>>>> Subject: Re: RE: Just a stab in the dark
>>>>> From: maurizio.cucchiara@gmail.com
>>>>> To: user@struts.apache.org
>>>>>
>>>>> Why do you prefer scanf to scanner class?
>>>>> I could be wrong, but I don't believe it is possible cause of the
>>>>> immutability of the string class (you cannot pass a string object as
>>>>> reference).
>>>>>
>>>>> Maurizio Cucchiara
>>>>>
>>>>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
>>>>> scritto:
>>>>>
>>>>> havent seen scanf method in any of the Java classes
>>>>> i welcome factoring a scanf method in
>>>>> org.apache.struts2.convention.StringTools
>>>>>
>>>>> anyone ?
>>>>> Martin
>>>>>
>>>>>
>>>>>> Date: Sat, 12 Mar 2011 12:57:17 +0000
>>>>>> From: ahardy.struts@cyberspaceroad.com
>>>>>> To: user@struts.apache.org
>>>>>> Subject: Just a stab in the dark
>>>>>> Hi List
>>>>>>
>>>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>>>> desperat...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Just a stab in the dark

Posted by Maurizio Cucchiara <ma...@gmail.com>.
I'm sorry, but unfortunately I have any implementation and to be
frankly I don't understand why Marting thought so :).
Adam, again, why do you prefer scanf to scanner?


On 13 March 2011 15:53, Adam Hardy <ah...@cyberspaceroad.com> wrote:
> I actually hoped I would find it in commons lang already - I was only asking
> on the struts list because I know the user list here is so much more diverse
> and would more likely know if it existed already somewhere.
>
> Do you Maurizio already have a scanf implementation? Or am I misinterpreting
> Martin's message to you?
>
> I should think it's about a day's work, with tests, plus a bit of thought
> needs to go into the design to make the parsing of the pattern string
> cacheable. That's why I was hoping to avoid writing scanf from scratch. But
> it looks like I'll have to make do with a temporary fix using Scanner on
> just the bits I need right now.
>
> Maurizio Cucchiara on 13/03/11 09:52, wrote:
>>
>> I think that the right place for this kind of questions is apache commons
>> lang ml.
>>
>> Maurizio Cucchiara
>>
>> Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha
>> scritto:
>>>
>>> you can use String constructor to construct what you need from any part
>>> of a previous String
>>> then use StringBuffer to concat the Strings together
>>> but Scanner will work too.
>>>
>>> Maurizio can you put a scanf method in StringTools that uses scanner to
>>
>> replicate scanf functionality and send it to dev@struts.apache.org?
>>>
>>> thanks,
>>> Martin
>>>
>>>
>>>> Date: Sat, 12 Mar 2011 17:16:44 +0100
>>>> Subject: Re: RE: Just a stab in the dark
>>>> From: maurizio.cucchiara@gmail.com
>>>> To: user@struts.apache.org
>>>>
>>>> Why do you prefer scanf to scanner class?
>>>> I could be wrong, but I don't believe it is possible cause of the
>>>> immutability of the string class (you cannot pass a string object as
>>>> reference).
>>>>
>>>> Maurizio Cucchiara
>>>>
>>>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
>>>> scritto:
>>>>
>>>> havent seen scanf method in any of the Java classes
>>>> i welcome factoring a scanf method in
>>>> org.apache.struts2.convention.StringTools
>>>>
>>>> anyone ?
>>>> Martin
>>>>
>>>>
>>>>> Date: Sat, 12 Mar 2011 12:57:17 +0000
>>>>> From: ahardy.struts@cyberspaceroad.com
>>>>> To: user@struts.apache.org
>>>>> Subject: Just a stab in the dark
>>>>> Hi List
>>>>>
>>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>>> desperat...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Just a stab in the dark

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I actually hoped I would find it in commons lang already - I was only asking on 
the struts list because I know the user list here is so much more diverse and 
would more likely know if it existed already somewhere.

Do you Maurizio already have a scanf implementation? Or am I misinterpreting 
Martin's message to you?

I should think it's about a day's work, with tests, plus a bit of thought needs 
to go into the design to make the parsing of the pattern string cacheable. 
That's why I was hoping to avoid writing scanf from scratch. But it looks like 
I'll have to make do with a temporary fix using Scanner on just the bits I need 
right now.

Maurizio Cucchiara on 13/03/11 09:52, wrote:
> I think that the right place for this kind of questions is apache commons
> lang ml.
> 
> Maurizio Cucchiara
> 
> Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha scritto:
>> you can use String constructor to construct what you need from any part of a previous String
>> then use StringBuffer to concat the Strings together
>> but Scanner will work too.
>>
>> Maurizio can you put a scanf method in StringTools that uses scanner to
> replicate scanf functionality and send it to dev@struts.apache.org?
>> thanks,
>> Martin
>>
>>
>>> Date: Sat, 12 Mar 2011 17:16:44 +0100
>>> Subject: Re: RE: Just a stab in the dark
>>> From: maurizio.cucchiara@gmail.com
>>> To: user@struts.apache.org
>>>
>>> Why do you prefer scanf to scanner class?
>>> I could be wrong, but I don't believe it is possible cause of the
>>> immutability of the string class (you cannot pass a string object as
>>> reference).
>>>
>>> Maurizio Cucchiara
>>>
>>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
>>> scritto:
>>>
>>> havent seen scanf method in any of the Java classes
>>> i welcome factoring a scanf method in
>>> org.apache.struts2.convention.StringTools
>>>
>>> anyone ?
>>> Martin
>>>
>>>
>>>> Date: Sat, 12 Mar 2011 12:57:17 +0000
>>>> From: ahardy.struts@cyberspaceroad.com
>>>> To: user@struts.apache.org
>>>> Subject: Just a stab in the dark
>>>> Hi List
>>>>
>>>> this is a bit OT but it's the weekend and I have a question which I am
>>>> desperat...
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: RE: Just a stab in the dark

Posted by Maurizio Cucchiara <ma...@gmail.com>.
I think that the right place for this kind of questions is apache commons
lang ml.

Maurizio Cucchiara

Il giorno 13/mar/2011 02.26, "Martin Gainty" <mg...@hotmail.com> ha
scritto:
>
> you can use String constructor to construct what you need from any part of
a previous String
> then use StringBuffer to concat the Strings together
>
> but Scanner will work too.
>
> Maurizio can you put a scanf method in StringTools that uses scanner to
replicate scanf functionality and send it to dev@struts.apache.org?
>
> thanks,
> Martin
>
>
>
>
>> Date: Sat, 12 Mar 2011 17:16:44 +0100
>> Subject: Re: RE: Just a stab in the dark
>> From: maurizio.cucchiara@gmail.com
>> To: user@struts.apache.org
>>
>> Why do you prefer scanf to scanner class?
>> I could be wrong, but I don't believe it is possible cause of the
>> immutability of the string class (you cannot pass a string object as
>> reference).
>>
>> Maurizio Cucchiara
>>
>> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
>> scritto:
>>
>> havent seen scanf method in any of the Java classes
>> i welcome factoring a scanf method in
>> org.apache.struts2.convention.StringTools
>>
>> anyone ?
>> Martin
>> ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
le
>> destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
copie
>> de ceci est interdite. Ce message sert à l'information seulement et
n'aura
>> pas n'importe quel effet légalement obligatoire. Étant donné que les
email
>> peuvent facilement être sujets à la manipulation, nous ne pouvons
accepter
>> aucune responsabilité pour le contenu fourni.
>>
>>
>>
>>
>> > Date: Sat, 12 Mar 2011 12:57:17 +0000
>> > From: ahardy.struts@cyberspaceroad.com
>> > To: user@struts.apache.org
>> > Subject: Just a stab in the dark
>>
>> >
>> > Hi List
>> >
>> > this is a bit OT but it's the weekend and I have a question which I am
>> > desperat...
>

RE: Just a stab in the dark

Posted by Martin Gainty <mg...@hotmail.com>.
you can use String constructor to construct what you need from any part of a previous String
then use StringBuffer to concat the Strings together

but Scanner will work too.

Maurizio can you put a scanf method in StringTools that uses scanner to replicate scanf functionality and send it to dev@struts.apache.org?

thanks,
Martin 




> Date: Sat, 12 Mar 2011 17:16:44 +0100
> Subject: Re: RE: Just a stab in the dark
> From: maurizio.cucchiara@gmail.com
> To: user@struts.apache.org
> 
> Why do you prefer scanf to scanner class?
> I could be wrong, but I don't believe it is possible cause of the
> immutability of the string class (you cannot pass a string object as
> reference).
> 
> Maurizio Cucchiara
> 
> Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
> scritto:
> 
> havent seen scanf method in any of the Java classes
> i welcome factoring a scanf method in
> org.apache.struts2.convention.StringTools
> 
> anyone ?
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
> 
> 
> 
> 
> > Date: Sat, 12 Mar 2011 12:57:17 +0000
> > From: ahardy.struts@cyberspaceroad.com
> > To: user@struts.apache.org
> > Subject: Just a stab in the dark
> 
> >
> > Hi List
> >
> > this is a bit OT but it's the weekend and I have a question which I am
> > desperat...
 		 	   		  

Re: RE: Just a stab in the dark

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Why do you prefer scanf to scanner class?
I could be wrong, but I don't believe it is possible cause of the
immutability of the string class (you cannot pass a string object as
reference).

Maurizio Cucchiara

Il giorno 12/mar/2011 15.22, "Martin Gainty" <mg...@hotmail.com> ha
scritto:

havent seen scanf method in any of the Java classes
i welcome factoring a scanf method in
org.apache.struts2.convention.StringTools

anyone ?
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.




> Date: Sat, 12 Mar 2011 12:57:17 +0000
> From: ahardy.struts@cyberspaceroad.com
> To: user@struts.apache.org
> Subject: Just a stab in the dark

>
> Hi List
>
> this is a bit OT but it's the weekend and I have a question which I am
> desperat...

RE: Just a stab in the dark

Posted by Martin Gainty <mg...@hotmail.com>.
havent seen scanf method in any of the Java classes
i welcome factoring a scanf method in org.apache.struts2.convention.StringTools

anyone ?
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sat, 12 Mar 2011 12:57:17 +0000
> From: ahardy.struts@cyberspaceroad.com
> To: user@struts.apache.org
> Subject: Just a stab in the dark
> 
> Hi List
> 
> this is a bit OT but it's the weekend and I have a question which I am 
> desperate to answer and my googling skills are no match for it.
> 
> Does anyone know where I can get a Java implementation of scanf?
> 
> 
> I want to do C-style scanf and read a string into a list of parameters - 
> the exact corollary of printf, rather than the slightly lame 
> implementation java.util.Scanner which won't automatically read a whole 
> set of values of different types into the same types that printf can 
> handle, e.g. Calendar and Date.
> 
> e.g. I can do this for formatting:
> 
> System.out.format("Local time: %tT", Calendar.getInstance());
> 
> 
> but not for parsing.
> 
> Yours thro the google haze,
> 
> Adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>