编一个JAVA程序,字符串数组中查找一个指定的字符串。

[复制链接]
查看11 | 回复3 | 2010-10-20 18:15:34 | 显示全部楼层 |阅读模式
1、定义一个查找方法。2、主方法中定义数组初始化。

回复

使用道具 举报

千问 | 2010-10-20 18:15:34 | 显示全部楼层
List list = SearchL;
String s1 = list.getString(list.getSelectedIndex());
int i1 = s1.lastIndexOf(':', s1.length());
String s4 = s1.substring(i1 + 1, s1.length());
int j1 = Integer.parseInt(s4, 10);
DrawStr.cline = j1;
GuoCPU.setCurrent(BackDis);
DrawStr.cline = j1;
} else
if (
回复

使用道具 举报

千问 | 2010-10-20 18:15:34 | 显示全部楼层
String tmp = "tmp:for(String str: strs){if(tmp.equals(str)){ //....}}
回复

使用道具 举报

千问 | 2010-10-20 18:15:34 | 显示全部楼层
public class Test{ public static void main(String args[]){String[] strArys = new String[3]; strArys[0] = "1111"; strArys[1] = "2222"; strArys[2] = "33333";Str
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行