应用场景:1.7元 UI设计把1.7变大 元变小;
public String[] divideRoomName(String roomName) {
String[] name_Id = new String[2];
StringBuilder number = new StringBuilder();
StringBuilder m = new StringBuilder();
if (roomName.length() > 0) {
for (int i = 0; i < roomName.length(); i++) {
//取出每一个字符判断是否是汉字,汉字添加到numer,不是汉字的添加到m
if (roomName.substring(i, i + 1).matches("[\u4e00-\u9fa5]+")) {
m.append(roomName.substring(i, i + 1));
} else {
number.append(roomName.substring(i, i + 1));
}
}
name_Id[0] = number.toString();
name_Id[1] = m.toString();
}
return name_Id;
}