以前はコンマで区切るとコードは完全に機能しましたが、セミコロンでは機能しなくなりました。
カンマで:
public void loadXXXData() {
InputStream is = getResources().openRawResource(R.raw.xxxdata);
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
try {
String line;
String[] RowData;
RowData = new String[XXXVARNUM];
for(int i=0;i<NUMBEROFXXX;i++){
//Read the line.
line = reader.readLine();
//Cut the line up.
RowData = line.split(",",XXXVARNUM);
for(int j=0;j<XXXVARNUM;j++){
//Distribute the line into a 2D array.
XXX[i][j] = RowData[j];
}
}
//Populate forms
setCurrentXXX(XXX);
}
catch (IOException ex) {
Log.v("XXXdex", "I/O Exception: Could not read from the I/O stream.");
}
finally {
try {
//Close the stream
is.close();
}
catch (IOException e) {
Log.v("XXXdex", "I/O Exception: Could not close the I/O stream.");
}
finally {
}
}
}
finally {
}
}
セミコロンで:
public void loadItemData() {
InputStream is = getResources().openRawResource(R.raw.items);
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
try {
String line;
String[] RowData;
RowData = new String[ITEMVARNUM];
for(int i=0;i<NUMBEROFITEMS;i++){
//Read the line.
line = reader.readLine();
//Cut the line up.
RowData = line.split(";",ITEMVARNUM);
for(int j=0;j<ITEMVARNUM;j++){
//Distribute the line into a 2D array.
ITEM[i][j] = RowData[j];
}
}
//Populate forms
setCurrentItem(item);
}
catch (IOException ex) {
Log.v("XXXdex", "I/O Exception: Could not read from the I/O stream.");
}
finally {
try {
//Close the stream
is.close();
}
catch (IOException e) {
Log.v("XXXdex", "I/O Exception: Could not close the I/O stream.");
}
finally {
}
}
}
finally {
}
}
xxxDataからのサンプル:
1,dinosaur,Grass,Poison,45,49,49,65,65,45,Supergrow,,DrPhyll,64,0,0,0,1,0,0,45,0.7 m,6.9 kg,Seed
...完全にロードされます。
itemDataからのサンプル:
Antidote;A spray-type medicine. It lifts the effect of poison from one XXX.;Route 3, Pinwheel Forest, Pinwheel Forest, Pinwheel Forest (With Dowsing Machine), Icirrus City Shop Route 9, Accumula Town, Striaton City, Nacrene City, Castelia City, Nimbasa City, Driftveil City, Mistralton City, Icirrus City, Opelucid City, XXX League, Lacunosa Town, Undella Town, Black City, White Forest
...正しく分割されません。どうしたの?「;」を表す正規表現を探してフォーラムを調べましたが、何も機能しません。String.splitが文字列を正しい数の文字列に分離していないため、arrayIndexOutOfBounds例外が発生し続けます。