I need to check if the Chinese province is in the address in Chinese.
I can read and write Chinese characters easily.
I tried using the indexOf () method for String to check if the province (e.g. εΉΏδΈ) is contained in the address (δΈε½ εΉΏδΈ). However, this always returns -1.
When I try to check the numbers (e.g. whether 103 is contained in 9910399), it works fine.
Do I need to do something else to handle UTF-8 string matching? Thank you Matt
, . indexOf() .
, (*.java). , eclipse, Window/Preferences/General/Workspace/Text file Encoding. UTF-8.
-, , java-. . , javac , , -encoding. , , .
javac
-encoding
.