Android If user enters the uppercase also it should be in lowercase - android-edittext

IF user enters the characters in uppercase also it should display in lowercase only
Regards,
Nikhilreddy

You can use this:
String s = textView.getText().toString().toLowerCase();

Related

In Google Sheets how do I enter the plus sign at the start of a field value?

I'm creating a spreadsheet where one column must hold phone numbers.
Some phone numbers have the plus sign at the beginning of the string.
However, Attempting to enter a '+' at the start of a field activates a feature of Google Sheets.
How do I turn this feature off and get fields to just accept alphanumeric strings?
You should use an "escape" character: '
This way:
'+1234
you can add it as text string like:
="+99 555 653"

Instagram username Regex for Swift

I am looking for the regex to filter username just like the instagram usernames.
I don’t know much about regex but I can use it in my swift function.
As I know that regex algorithms changes depending on the programming language, so I need that instagram username regex for swift language.
Thanks
Instagram username rules
Two matches # mentions with no space between #thebox193#discodude
Matches with one . in them #disco.dude but not two .. #disco..dude
Beginning period not matched #.discodude
Ending period not matched #discodude.
Match underscores _ #_disco__dude_
Max characters of 30 #1234567890123456789012345678901234567890
Regex
(?:#)([A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)
More information here
https://blog.jstassen.com/2016/03/code-regex-for-instagram-username-and-hashtags/
This should work /^(?!...)(?!..$)[^\W][\w.]{0,29}$/igm
Fiddle for this: https://regexr.com/3cg7r

detect where and what changes within textfield

How can I check what exactly and where a string changed in my textfieldDidChange method?
let str1 = "Hello how are you #Marie, nice day uh?"
So imagine my user decides to edit the text and link markus instead of marie
let str2 = "Hello how are you # Markus, nice day uh?"
I need a method that detect the change of # Markus in the text field but doesn't change anything else in the string.
I am able to detect last word, first word and so one, but its important to also see what changed within the text
i am thinking about a method that
a = "Hello how are you"
b = newly changed text field
c = ", nice day uh?"
let str3 = a + b + c // More or less
Maybe that I get the index where I am editing at, taking the word out at this index - from left space to right space - and cutting it out?
Thanks in advance, yes I am a beginner :P
If you set your view controller up to be the delegate of your text field, you can implement the textField(_:shouldChangeCharactersIn:replacementString:) delegate method. That will tell you the range of characters that the user has asked to change, as well as providing the replacement string.
You could use that to monitor the user's edits. However, the string can easily get changed in a way that is difficult to track. What if the user deletes the "Hello how are you " part? What if they replace the whole string with "Shut your festering gob #fred, you malodorous pervert"?
You're probably better off getting the whole string from the text field and parsing it. You could accept anything the user enters, an look for and # sign, and take everything after that until the next space as the name, e.g. #alphanumerics`
Edit:
Alternately, you could set up your screen so the first part is a label, the middle part is an editable text field, and the last part is another label. The only part the user is able to edit is the middle part, the name. Or you could make it 3 separate text fields, the prefix, the name, and the suffix. Tell the user what you expect them to enter into each part.
You can split your string using this code.
For Objectve c :
1. Create function like this.
-(NSString *)checkString:(NSString *)splitString{
NSRange firstObj = [splitString rangeOfString:#"#"];
NSRange secondObject = [splitString rangeOfString:#","];
NSRange rangeSubStr = NSMakeRange(firstObj.location + firstObj.length, secondObject.location - firstObj.location - firstObj.length);
return [splitString substringWithRange:rangeSubStr];
}
2. Use this function like this.
[self checkString:#"Hello how are you #Marie, nice day uh?"]
Then every change in text, you can check substrings, and compare them to original substrings.

Float is not recognizing numbers with a "," between it

When using the UIKeyboardTypeNumberPad option, the button in the bottom left will be a ",". But I want a ".", not a ",".
Is it possible to change this?
Can I add an extra button to the NumberPad?
Or can I change every "," with a "."?
The decimal keypad shows either a period or a comma depending on the user's locale as set in the Region Format setting in the Settings app (Settings -> General -> International).
You don't want to force a period. Users in locales that expect a comma want to see a comma.
If you need to convert a user-entered number string into a number, use NSNumberFormatter to do so. This will properly deal with the user's locale and number format.

cxGrid uppercase letters only

Is there a way to have cxGrid (devexpress) accept only uppercase letters ? Or have it accept uppercase only for certain fields ? I could not find any setting in the grid that would achieve this...
Set Column.Properties to TextEdit and then
Column.Properties.CharCase = ecUpperCase

Resources