有一个字符串数组,row[]
我想在它们之间放置分隔符。我想保留订单,例如,如果
row[0] was "Gold",
row[1] was "Costly",
row[2] was NULL,
row[3] was NULL,
row[5] was "Bronze",
row[6] was "Cheaper",
当我在字符串数组中放置分隔符时,我想保留 NULL 值,比如 \t 。所以我的新字符串应该看起来像
'Gold \t Costly \t \t Bronze \t Cheaper'.
我可以做类似的事情
'System.out.println(row[0] + "\t" + row[1] +"\t" +row[2]+.......'
但问题是字符串数组的长度超过 120。有一个更好的方法吗?(我不能使用 for 循环,因为我要把它和其他东西放在映射器中)。如果是String.format(),你能告诉我怎么做吗?