[68] in java-interest

home help back first fref pref prev next nref lref last post

Re: Does java have "split"

daemon@ATHENA.MIT.EDU (Colin B. Boatwright)
Mon May 8 20:19:49 1995

Date: Mon, 8 May 1995 19:45:24 -0500
To: java-interest@java.Eng.Sun.COM
From: Colin@nando.net (Colin B. Boatwright)

>Check out the java.util.StringTokenizer class.  The example usage shows
>just how to do this.  The following URL will get you to the class API
>documentation for it:
>
>        doc:///doc/api/java.util.StringTokenizer.html#_top_

That is exactly what I'm looking for. I just can't get it to work.

--- Partical program below ---

import awt.*;
import java.lang.*;
import browser.*;
import net.www.html.*;
import Object;
import java.io.*;
import java.util.*;

class Byrn3 extends Applet implements Runnable {

String   cutline;

   public void init() {
      cutline            = getAttribute("cutline");
      StringTokenizer cl = new StringTokenizer(cutline);
      while (cl.hasMoreTokens()) {
         println(cl.nextToken());
      }
   }

}

My normal error is that println is invalid. I really don't even want to use
println.  Below is logically what I want:

   public void init() {
      String a = "This is a test";
      StringTokenizer aa = new StringTokenizer(s);
      while(aa.hasMoreTokens()) {
         i++;
         aaa[i] = aa.nextToken;
      }
      repaint();
   }

  public void paint(Graphics g) {
     for (int i; i < 10; i++) {
        g.drawString(aaa[i], 0, 0);
     }
  }

Naturally, I've defined the variables. And this is a basic skeleton.

Thoughts anyone?


-------------------------------------
Colin B. Boatwright (Colin@NandO.net)
NandO Web guy


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post