A little bit better, because the tokenizer is only visible in the
loop:
for (StringTokenizer $TOKENIZER$ = new StringTokenizer($STRING$);
$TOKENIZER$.hasMoreTokens();) {
String $VAR$ = $TOKENIZER$.nextToken();
$END$
}
Tom
On Wed, 28 Aug 2002 10:02:43 -0400, "Chris Bartley" <[EMAIL PROTECTED]>
wrote:
> Neat. However, why the use of TOKENIZER_COPY? This should have the same
> behavior, i think:
>
> StringTokenizer $TOKENIZER$ = new StringTokenizer($STRING$);
> while ($TOKENIZER$.hasMoreTokens()) {
> String $VAR$ = $TOKENIZER$.nextToken();
> $END$
> }
>
>
> Nice template, thanks for sharing.
>
> chris
>
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > I'm using the abbreviation 'itst' for Iterate String Tokens.
> >
> > Here's the template:
> >
> > StringTokenizer $TOKENIZER$ = new StringTokenizer($STRING$);
> > while ($TOKENIZER_COPY$.hasMoreTokens()) {
> > String $VAR$ = $TOKENIZER_COPY$.nextToken();
> > $END$
> > }
> >
> > Where variables look like this:
> >
> > TOKENIZER suggestVariableName() "tokenizer"
> > STRING variableOfType("java.lang.String")
> > VAR suggestVariableName() "token"
> > TOKENIZER_COPY TOKENIZER
> > <tick>
> >
> > Gives code that looks like:
> >
> > StringTokenizer tokenizer = new StringTokenizer(myString);
> > while (tokenizer.hasMoreTokens()) {
> > String token = tokenizer.nextToken();
> > |
> > }
> >
> > Make sure you tick 'Reformat code according to style'.
> >
> > Additionally, there should be some sort of message in the
> > live-template-creation window to let users know then can 'Right-click for
> > available methods'... this isn't obvious!
> >
> > Drew Noakes
> >
> > ThoughtWorks, Inc. UK
> > [EMAIL PROTECTED]
> > 07941.725.355
> >
> >
> >
>
>
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features