Looking on input types that a EditText view can have i seen "textPersonName" and i try to search a way to (if possible) split name and surname using maybe a method like editText.getName. My question is exist a method of edittext that splits name and surname in edittext? And if don't exist the best way is to use split or else?
The textPersonName is just a style option, for instance it capitalizes the first letter of each word. It won't help you distinguish first and last names. However you can search for spaces, for instance:
String[] names = editText.getText().toString().split(" ");
The Array of Strings will have each name in a different String. If the user entered: John Doe you would have "John" in names[0] and "Doe" in names[1].
Related
I have layout when user have to write name and surname. How can I check if he truly wrote name an surname and doesn't write numbers or other marks instead of it. Please, help!
You can specify inputType of your EditText.
https://developer.android.com/reference/android/widget/TextView#attr_android:inputType
Also you can add TextWatcher to your EditText and check user input
https://developer.android.com/reference/android/text/TextWatcher
Try this
It wont allow any special character or numeric value in EditText
android:digits="abcdefghijklmnopqrstuvwxyz"
I want to capitalize first word of abbreviations like dr. mr. etc.
search over the internet but didn't find any useful thing about it.
i tried
String capitalized = WordUtils.capitalize(sb.toString(), '.', ' ');
System.out.println(capitalized);
but it capitalize first word of every sentence.
Thanks in advance.
Make a regex that could find title like mr. dr., etc.. RegEx: Match Mr. Ms. etc in a "Title" Database field
Prepare an array with indexes that need to be capitalised.
Create utility method that does the conversion process. Capitalize various letters in a string
I have one userID edittext field, here I am allowing alphabets and numbers and '.' and '_' and '#' special characters. But how to restrict only '.' and '_' and '#' in edittext field? I want to restrict like this:
After text only I want to allow those special characters.
Only one time I want to allow those spl characters(don't allow two times like ##,..,__ like this)
end of the userID no spl characters.
test.new_bike sample example for valid.
test..new__bike,........,______,###### like words I won't allow.
please help me,this is my regex
^(([A-Za-z0-9]+\\s{1}[A-Za-z0-9]+)|([A-Za-z0-9._]+))$
Try this one
"^[A-Za-z0-9]+[\\.\\#\\_]{0,1}[A-Za-z0-9]+[\\.\\#\\_]{0,1}[A-Za-z0-9]+[\\.\\#\\_]{0,1}[A-Za-z0-9]+$"
In my database i had one column as name, where in this column it has name of all recipe names with english and french character.
When i search a string like query:
Select recipe.name from recipe_table where name LIKE = %crepe%
it gives me no result. But it should return one result this-"crèpes"
So i need: search through english alphabet and give me result of all english + french alphabet , it means all result.
thank you in advance .
Instead of searching Spanish character I had created one more column as name2 where i convert all Spanish name to English name.
And then I search English characters from column name2.
First of all I think that the encoding of the database must be UTF-8.
Then:
Select recipe.name from recipe_table where name LIKE = %crepe%
will find any values that have 'crepe' in any position, and you need 'crèpe'.
Possibly you can change french characters by _ .
Select recipe.name from recipe_table where name LIKE = %cr_pe%
But I'm not sure.
Also there are some solutions:
1) Try to search how to rebuild android's sqlite with icu support.
2) Or use custom cursor wrapper like this
Friend's
I'm working upon searching in maps, here i have string in my array,when i enter characters for searching in Edit text box,i need the string have started with similar character in my result.
for example in my array i have String[] name ={"A","B","BB","Boys","Box"}
Initially i have all the array string in my result,if i suppose enter an character like b in editbox i need filter and show the charcters matches with b that is "B","BB",""Boys","Box",if suppose i enter two characters like "bo"in editbox ,i need result strings "Boys","Box"in another array.
Help me.
thanks in advance.
Consider using AutoCompleteTextView instead of simple EditText.