Re: [問題] String的問題
※ 引述《breakofdawn (hi)》之銘言:
: int i=0, count=0;
: StringTokenizer st = new StringTokenizer(rawString,",");
: count=st.countTokens();
: String[] first = new String[count];
: String[] second = new String[count];
用一個StringBuffer將每次切出來的first array加起來
最後再把這個buffer的值丟進second array
StringBuffer temp = new StringBuffer();
: while (st.hasMoreTokens()) {
: first[i]=st.nextToken();
temp.append(first[i] + ",");
second[i] = temp.toString();
: i++;
: }
: 我這邊將first[0]變成了abc,first[1]變成了def...,etc
: 之後想讓second[0]變成abc,
: second[1]變成abc,def, ....,etc
: 希望我表達的還算清楚.謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.73.116.236
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 6 篇):