格式化平行列的字符串,格式化行列字符串,for(i = 0; i
分享于 点击 33714 次 点评:105
格式化平行列的字符串,格式化行列字符串,for(i = 0; i
for(i = 0; i < lastName.length; i++){ chars[i] = (firstName[i] + lastName[i]).length(); chars[i] = 17 - chars[i];//use larger number if strings are bigger spaces[i] = ""; while (chars[i]>0){ chars[i]--; spaces[i] += " "; }newArray[i] = lastName[i] + ", " + firstName[i] + spaces;/** Nick Stanish* newArray[i] is the formatted column, if the arrays are confusing* then replace with a single string for easer readability*/}//displaySystem.out.println(newArray[0] + "other string");
用户点评