Problem With Empty String Value

Bill Norris

Active Member
Licensed User
Longtime User
I think I can describe this without posting code, so here goes.

I have a row in a SQLite column that contains an empty string value, stored as '' in the cell.

I read the value of that cell into the text property of a label, and the label displays "".

Now, I want to test the text property of that label in code, and I cannot get any statement to yield True.

I have tried the following:

(double quotes) If label.text="" then ...
(single quotes) If label.text='' then ...
(single quotes enclosed in double quotes) if label.text="''" then ...
(double quotes enclosed in double quotes) if label.text="""" then ...

Any suggestions? How does B4A handle empty strings?

Thanks in advance.
 

Bill Norris

Active Member
Licensed User
Longtime User
QUOTE doesn't do it either. I can certainly use the length property as a workaround, but since with VB you can test for an empty string with "", I assumed b4a would have similar functionality.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If the label is displaying "" then you would probably need to test for Quote&Quote as the string isn't really empty.

See if that works.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
At first I would check the length of the String you get back from the database before you set it to the Label.Text property.
If the length is >0 then check what character(s) there are.
If the length = 0 the it should work.

Best regards.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…