cbanks Active Member Licensed User Longtime User Mar 23, 2012 #1 Right now I have the following code to detect if the EditText is blank. It works if there are no carriage returns. What should the code look like to detect the EditText is blank if there is nothing in the box other than carriage returns? Thanks. If EditTextNotes.Text = "" Then
Right now I have the following code to detect if the EditText is blank. It works if there are no carriage returns. What should the code look like to detect the EditText is blank if there is nothing in the box other than carriage returns? Thanks. If EditTextNotes.Text = "" Then
NJDude Expert Licensed User Longtime User Mar 23, 2012 #2 Something like this: B4X: Content = EditTextNotes.Text If Content.Lenght = 0 Then Last edited: Mar 23, 2012 Upvote 0
timwil Active Member Licensed User Longtime User Mar 23, 2012 #3 I usually use VariableName.Text.Length to see how long a string is If it is longer than zero then you can read it and check for chr(10) Upvote 0
I usually use VariableName.Text.Length to see how long a string is If it is longer than zero then you can read it and check for chr(10)
K kickaha Well-Known Member Licensed User Longtime User Mar 23, 2012 #4 timwil said: I usually use VariableName.Text.Length to see how long a string is If it is longer than zero then you can read it and check for chr(10) Click to expand... Or use regex to check for any character other than chr(10), the "." does this. Upvote 0
timwil said: I usually use VariableName.Text.Length to see how long a string is If it is longer than zero then you can read it and check for chr(10) Click to expand... Or use regex to check for any character other than chr(10), the "." does this.
nfordbscndrd Well-Known Member Licensed User Longtime User Mar 23, 2012 #5 If Replace(EditTextNotes.Text, CRLF, "") <> "" Then [it has some text] I haven't tested this, but I think that's how Replace works. (I'm sure someone will correct me if I'm wrong.) Upvote 0
If Replace(EditTextNotes.Text, CRLF, "") <> "" Then [it has some text] I haven't tested this, but I think that's how Replace works. (I'm sure someone will correct me if I'm wrong.)
Erel B4X founder Staff member Licensed User Longtime User Mar 24, 2012 #6 You can check: B4X: If EditText1.Text.Trim.Length = 0 Then ... Upvote 0
nfordbscndrd Well-Known Member Licensed User Longtime User Mar 24, 2012 #7 Erel said: You can check: B4X: If EditText1.Text.Trim.Length = 0 Then ... Click to expand... If the text is " " & CRLF & " ", will Trim get rid of the CRLF as well as the spaces? If so, I don't think this is mentioned in the docs. Upvote 0
Erel said: You can check: B4X: If EditText1.Text.Trim.Length = 0 Then ... Click to expand... If the text is " " & CRLF & " ", will Trim get rid of the CRLF as well as the spaces? If so, I don't think this is mentioned in the docs.
specci48 Well-Known Member Licensed User Longtime User Mar 24, 2012 #8 nfordbscndrd said: If the text is " " & CRLF & " ", will Trim get rid of the CRLF as well as the spaces? Click to expand... Yes. specci48 Upvote 0
nfordbscndrd said: If the text is " " & CRLF & " ", will Trim get rid of the CRLF as well as the spaces? Click to expand... Yes. specci48