0

Initially, I was trying to parse a String into parts and found split method. Then I realized that I cannot use it, because the compiler does not support most of the functions and methods. I thought I found a solution here which suggests StringTokenizer, but I am still getting cannot find symbol error even though java.util.* is imported. I am using Java WTK 2.5.2 for CLDC. Do I have to write everything from scratch whenever I get an error or is there anything that I missed? I am not familiar with Java, so any answer will be appreciated.

import java.io.*;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
public class Program extends MIDlet implements CommandListener
{
    public Program()
    {
        ...
    }
    public static String[] split(String data, String token)
    {
        StringTokenizer st = new StringTokenizer("this_is_a_test", "_");
        return null;
    }
}
error: cannot find symbol
        StringTokenizer st = new StringTokenizer("this_is_a_test", "_");
        ^
  symbol:   class StringTokenizer
  location: class Program
1

1 Answer 1

0

It looks like most of the general functions and methods cannot be used in micro edition. So, I had to implement my own case-specific function to solve the problem. Here are some useful links that show what can be used:
Documentation
Tutorial & Examples

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.