FAQ Database Discussion Community


Coalescing Swift operator for an empty non-nil string

string,swift,variable-assignment,empty-string
I have a string variable in Swift: let foo = "bar" But it can also be any other arbitrary string. Now I want to do the following: let bar = ... // either the value of foo, or if foo is "", it will be "default" I looked up "coalescing...

SQL BIT column must be blank vs TRUE on output, NULL vs 1 on input

mysql,sql,database,null,empty-string
This is what my table needs to look like: MovieID Title YearReleased RatingID BW Subtitles 1 Quiet Man, The 1952 1 2 McLintock! 1963 3 3 Thin Man, The 1934 0 TRUE 4 Tampopo 1985 4 TRUE This is the code I have so far: CREATE TABLE MOVIE (MOVIE_ID VARCHAR...

VBA If textbox is empty display all values

vba,ms-access,empty-string,ms-query
I have 2 textboxes and a button. The button opens a query with the values of the textboxes. Everything works fine, except when one textbox is empty then I want to find all the records from that textbox(So far I've tested it on textbox2). Here is my code: Private Sub...

How to Safely Query for a Potentially Nonexistent Value in SQLite?

c#,sqlite,nullreferenceexception,empty-string,executescalar
I've got this code, which works as long as there is a matching value in the database: public String GetDeptNameForDeptId(int deptId) { String deptName; const string qry = "SELECT Name FROM Department WHERE Id = @deptID"; try { using (SQLiteConnection con = new SQLiteConnection(HHSUtils.GetDBConnection())) { con.Open(); SQLiteCommand cmd = new...

Skip field if empty

javascript,empty-string,skip
I have 4 fields that can be filled in by end user. I would like to send the contents of these in an email but I don't want blank spaces in the email. What I am looking for is a way to ignore those empty field and only return those...

C# Regular Expression regex to match characters in last group, but not empty group

c#,regex,empty-string,capture-group
Please can any one advise me of a solution that will allow my regular expression to match the following data lines... 0002,Area (Region Name),No value 0003,Area (Region Name),Up North ...but should fail on this line (due to the empty last group) 0001,Area (Region Name), My current expression is: (?<BRANCH_CODE>[a-zA-Z0-9]{1,8}),(?<UDA_NAME>[a-zA-Z0-9!"\£\$\%\^\&\*\(\)\-+_ /]{1,50}),(?<UDA_VALUE>[a-zA-Z0-9!"\£\$\%\^\&\*\(\)\-+_...

Check an replace null values in multiple variables java

java,variables,null,empty-string
I'm trying to find an easy way to perform multiple null checks/ replacements in multiple variables in Java. I have an object with about 20 String variables. In the constructor I want to check if any of the variable values are null. If they are null I want to replace...

swift userdefaults settings testing value

swift,nsuserdefaults,empty-string
I need to test if the settings page has been completed when the app starts. What should I test for? This is what I tried but get an error unwrapping. The value is a string. I tried using ObjectForKey and tested for nil but same issue. I am new to...

Why can't I set object property to empty string in JavaScript?

javascript,undefined,empty-string
I want to pass the values from my request body into a paramsDict object where I have defined constraint to test the parameters against. I don't require that all possible parameters are sent with every request and also, if a value is deleted on the client, it can be sent...

How to check for empty text field?

java,swing,jtextfield,empty-string
I'm building a tool to generate a script of commands for integration purposes for some equipment using Java Swing. So basically the tool takes the user inputs in some text fields and then build the needed commands with the user variable. At the end of my script I'm displaying the...