ITeye博客

判断组是否相等

cbbs · 2010-09-14 11:52 · 编程语言 · Markdown

public boolean compare(String string[]) {
	String[] header = {"a","b","c"};
	if(string.length != header.length) {
		return false;
	}
	for (int i = 0; i < string.length; i++) {
		if ((string[i].trim().replaceAll(" ","").equals(header[i].trim().replaceAll(" ",""))) != true) { 
			return false;
		}
	}
	return true;
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。