public class TestString {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "Results 1-15 of 22410";
String str1 = "TestSomething1";
System.out.println(str.replaceAll("Results", "aa").replaceAll("of",
"bb"));
String[][] ss = new String[3][2];
System.out.println("the first dimension is " + ss.length);
System.out.println("the 2rd dimension is " + ss[ss.length - 1].length);
// this array which defined by dynamic method
for (int i = 0; i < ss.length; i++) {
for (int j = 0; j < ss[i].length; j++) {
ss[i][j] = "ITIS[" + i + "][" + j + "] : values";
}
}
// print these contents
for (int i = 0; i < ss.length; i++) {
for (int j = 0; j < ss[i].length; j++) {
System.out.println(ss[i][j]);
}
}
System.out.println("----------------------------");
// this array which defined by static method
String[][] stt = { { "a", "b", "c", "d" }, { "e", "f", "g" },
{ "w", "x" } };
for (int i = 0; i < stt.length; i++) {
for (int j = 0; j < stt[i].length; j++) {
System.out.println("stt[" + i + "][" + j + "] : " + stt[i][j]);
}
}
System.out.println("-----------------------------");
// this is a 3 rounds dimension
String[][][] srr = {
{ { "a", "b", "c", "d" }, { "q", "w", "e" }, { "y", "u" } },
{ { "a2", "b2", "c2", "d2" }, { "q2", "w2", "e2" },{ "y2", "u2" } },
{ { "a3", "b3", "c3", "d3" }, { "q3", "w3", "e3" },{ "y3", "u3" } } };
// this is a 4 rounds dimension array
// 4 rounds is one or more 3 rounds
String[][][][] sss = {
{
{ { "a", "b", "c", "d" }, { "q", "w", "e" }, { "y", "u" } },
{ { "a2", "b2", "c2", "d2" }, { "q2", "w2", "e2" },{ "y2", "u2" } },
{ { "a3", "b3", "c3", "d3","z3" }, { "q3", "w3", "e3" } }
},
{
{ { "a", "b", "c", "d" }, { "q", "w", "e" }, { "y", "u" } },
{ { "a2", "b2", "c2", "d2" }, { "q2", "w2", "e2" },{ "y2", "u2" } ,{ "y3", "u3" }}
}
};
System.out.println("this is four rounds dimension array print contents");
for(int i=0;i<sss.length;i++){
for(int j=0;j<sss[i].length;j++) {
for(int m=0;m<sss[i][j].length;m++){
for(int n=0;n<sss[i][j][m].length;n++) {
System.out.println("sss[" + i + "][" + j + "][" + m + "][" + n +"] : " + sss[i][j][m][n]);
}
}
}
}
}
}