编辑文本验证只有字母字符和单个单词

时间:2016-08-23 11:03:00

标签: android android-edittext

while(n > 0){ printf("Give me a char:"); scanf(" %c",&cur->c); cur->next = NULL; printf("Give me a number:"); scanf("%d",&n); if(n > 0) { cur->next = (letter*)malloc(sizeof(letter)); cur=cur->next; } } 应该只接受字母字符,EditText只接受单个字(空格字符也不允许)

1 个答案:

答案 0 :(得分:0)

在xml:

中的edittext中添加此属性
# handle trailing slashes (if not a directory)
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)/$ $1 [R,L]

# rewrite rule that internally adds the .html extension

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME}.html -f

RewriteCond %{REQUEST_FILENAME} !^.+\.html$

RewriteRule ^(.+[^/])$ $1.html

并在editText上添加一个过滤器来管理双重空间删除问题:

  android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"