简体   繁体   English

Java WTK 不能使用 StringTokenizer

[英]Java WTK cannot use StringTokenizer

Initially, I was trying to parse a String into parts and found split method.最初,我试图将一个String解析为多个部分并找到了split方法。 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.我以为我在这里找到了一个建议StringTokenizer的解决方案,但即使导入了java.util.*我仍然无法找到符号错误。 I am using Java WTK 2.5.2 for CLDC.我正在为 CLDC 使用 Java WTK 2.5.2。 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.我不熟悉 Java,所以任何答案将不胜感激。

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

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教程和示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM