问改变。
我来自伊朗和放大器;我们的文字语言为波斯语;
我有计数输入的字符短信计数器;
我想,当用户键入英语
字符(英文字符+演唱+号),计数变量做++来编号:160
,
但是,如果在所有的有RA 波斯
字符,计数变量做++来号码:70
我应该做的。
我被罚,这code: VAR UCS2 = text.search(/ [^ \ x00- \ x7D] /)
在 PHP
返回什么字符的用户;波斯字符或英文。
相当于code在Java中 - Android是什么
?
私人最终TextWatcher TextWatcher_Method =新TextWatcher()
{
公共无效onTextChanged(CharSequence的arg0中,诠释ARG1,诠释ARG2,INT ARG3)
{
CNT2 = matn_counter.length();
TextView的计数器=(TextView中)findViewById(R.id.txt_counter);
CNT1 =(INT)Math.ceil(CNT2 / 6);
整数CNT3 =(CNT2%6);
counter.setText(Integer.toString(CNT1)+/+ Integer.toString(CNT3));
}
}
解决方案
您可以使用的比迪烟类。 更多信息看这个答案吧。
Question changed.
I'm From Iran & our Written language is Persian;
i have a SMS counter that count typed character;
i wanna when user type English
char(English chars + sings + numbers) ,counting Variable do ++ to Number: 160
,
But , if In all there r a Persian
char , counting Variable do ++ to Number: 70
what i should to do.
I Fined that this code : var ucs2 = text.search(/[^\x00-\x7D]/)
in php
return What character user ; Persian char or English.
The equivalent code in Java - What is Android؟
private final TextWatcher TextWatcher_Method = new TextWatcher()
{
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3)
{
cnt2=matn_counter.length();
TextView counter=(TextView)findViewById(R.id.txt_counter);
cnt1=(int) Math.ceil(cnt2/6);
Integer cnt3=(cnt2%6);
counter.setText(Integer.toString(cnt1)+"/"+Integer.toString(cnt3));
}
}
解决方案
You can use Bidi class. for more info look at this answer please.