私はJavaとエンコーディングが初めてなので、この質問です。
私は基本的に、16 進数値で表される有効な文字のセットを含むテキスト ファイルを持っています。例: 0x2000-0x4002,0x5002-0x5F00
これで、文字列を含む別のファイルができました。例: このファイルを使用しようとしています。
私の問題は、2番目のファイルの各文字が有効で、上記のファイルで説明されている範囲内にあるかどうかを確認することです。
だからこれは私がやっていることです:
public class Test
{
//This is a function used to build the ranges.
public void build range() {}
//This function will test whether the string str is in given range.
public bool check range(String str)
{
int codePointCount = str.codePointCount(0, str.length());
for( in ti =0; i< codePointCount; i++)
{
int value = str.codePointAt(i);
if( value >= 2000 && value <= 4002 )
continue;
if( value >= 5002 && value <= 5F00 )
continue;
return false;
}
return true;
}
}
このコードが正しいかどうか、またはエンコードに関して何か不足しているかどうかをお知らせください。