For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2004 > Re: Is there in Java switch command for String? stomper









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Is there in Java switch command for String? stomper
xaos

2004-04-23, 1:39 pm

Roy Smith wrote:
> In article <9nis60dcqv6h4s4j2hfi3kdfc8i2n8f544@4ax.com>,
> Roedy Green <look-at-the-website@mindprod.com> wrote:
>
>
>
>
> What's a "stomper"?


A Stomper takes a list of names, and iitializes them.

here's such a tool (and others) embedded in html with javascript

http://home.comcast.net/~stronghear...mper_tools.html


note: all tokens are comma separated.

first tools are various text case converters,
the next two enquote and dequote tokens,
"to final int" is the "stomper" - a better description than what I used.

in all cases, enter a list of "tokens"
enter this into textarea

house,
car,
peanut stand

select the mode - the stomper is most relavant...
press change" and this is what gets converted

public static final int
HOUSE=0,
CAR=1,
PEANUT STAND=2,

public static final String[] XX=
{
"house","car","peanut stand"
};


switch(key)
{
case HOUSE :

break; case CAR :

break; case PEANUT_STAND :

break; default :
}


the initialized final ints suitable for switch statements.
the initialized String[] of names.
and a skeleton of a switch statements.

It's a little bit broken, (PEANUT STAND=2, should be PEANUT_STAND=2; )
sloppy, and not in java.
some code is totally busted and not called, some code anticipates
enhancements.

however I find it usefull, as net beans doesn't have a case converter
and the stomper makes pretty quick work of property management.
I often have the browser open for api's anyway.

~SS~










Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com