Using StringTokenizer in J2ME / JavaME applications

September 17th, 2006 Posted in J2ME / JavaME, Tips, Tricks, Guide

For those who worked with J2ME application, you should by now noticed that J2ME has strip down many classes from the standard java library, and this include StringTokenizer.

Why do you need StringTokenizer ?

For starters, StringTokenizer enables you to breakup delimited text and assign it separately, a text like :

99|Max Headroom|32|124, Park May Avenue,LA

can be separated to :

id : 99

Name : Max Headroom

Age : 32

Address :  124, Park May Avenue,LA

with relative ease. This delimited format is important because it is a relatively compact format to transfer data between client-server application (xmlrpc,soap are too bloated), because the simpler the format is, the faster the operating will be.

Because J2ME does not have StringTokenizer implementation, I was forced to adapt another StringTokernizer to be use in J2ME applications. For this i choose to adapt from Stephen Ostermiller java class, which can run smoothly in J2ME devices.

I've included the modified StringTokenizer class with a demo app on how to use the class in this zip file : StringTok.zip
Hope you enjoy the download, please contact me if you have any further questions.

[tags]j2me,java,javame, java class, StringTokenizer, mobile[/tags]

 

Random Posts

7 Responses to “Using StringTokenizer in J2ME / JavaME applications”

  1. Adapting StringTokenizer for J2ME : mypapit gnu/linux blog Says:

    [...] Besides being a GNU/Linux user (Ubuntu user specificly), my favorite past time (was) include coding mobile application in Java (JavaME), and here’s a post that I write about my modified StringTokenizer class that can be use in J2ME / JavaME application : Using StringTokenizer in J2ME application [...]



  2. StringTokenizer unresolved Says:


  3. J2MeForum :: Thema anzeigen - StringTokenizer Says:

    [...] nein, die J2ME spezifikation sieht keine stringtokenizer klasse vor. im polish gibt es sie allerdings, und auch andere stellen eigene klassen zur verf?gung… auch suchmaschinen eignen sich super f?r solche fragen! http://mobilepit.com/09/using-stringtokenizer-in-j2me-javame-applications.html_________________ ?To alcohol, the cause of, and solution to, all of life? s problems.? – H.J. Simpson [...]



  4. Alex Linn Says:

    Thank you so much it work perfectly, GENIOUS WORK



  5. Rodrigo Says:

    Thanks Man. I was looking for something like this.

    I’m developing a sync file app for mobiles.



  6. Arecibo Says:

    Or you could just use indexOf() and substring().

    I mean, I would probably build the same class if I worked on mobile apps enough, but if you can’t build something like this on your own..



  7. darkMdw Says:

    Thank you very much, this is just what I needed, you are a good people.



Leave a Reply