objective-c - textfield输入字符串过滤
伊谢尔伦
伊谢尔伦 2017-05-02 09:27:53
0
3
643

textField输入的时候过滤字符串,只能输入中文,其他的都不让输入

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
刘奇

During the input process, I first use regular expressions to determine whether the input is Chinese. If it is Chinese, assign it to textfiled.text, and then store this value in a global variable. Later, when textfiled.text changes, if there is a non-Chinese character Characters, use the previously stored global variables to intercept the string, and only the Chinese string is assigned to textfiled.text, so that textfiled can only input Chinese during the input process.

漂亮男人

You can judge the text in the proxy method. If there are English numbers, just delete them

滿天的星座

This may not be possible, because when typing Chinese pinyin before finishing typing, the English words will be displayed. If there are non-Chinese characters in the construction, the save button will be grayed out, and the user will be prompted to delete the non-Chinese characters.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!