isnullorempty

How do I check for null or empty string for many arguments? - C#

▼魔方 西西 提交于 2020-07-15 22:52:30
问题 I have the below method, which I need to check for whether the arguments are empty or null. public DB Where(string field, string operat, string value, string andOr, string field2, string operat2, string value2) { _Where = " WHERE " + field + " " + operat + " @" + field + "1 " + andOr + " " + field2 + " " + operat2 + " @" + field2 + "2 "; _Params.Add(field + "1", value); _Params.Add(field2 + "2", value2); return this; } I have found the string.IsNullOrWhiteSpace method however this would

'IsNullOrWhitespace' in JavaScript?

牧云@^-^@ 提交于 2020-01-19 03:10:13
问题 Is there a JavaScript equivalent to .NET's String.IsNullOrWhitespace so that I can check if a textbox on the client-side has any visible text in it? I'd rather do this on the client-side first than post back the textbox value and rely only on server-side validation, even though I will do that as well. 回答1: It's easy enough to roll your own: function isNullOrWhitespace( input ) { if (typeof input === 'undefined' || input == null) return true; return input.replace(/\s/g, '').length < 1; } 回答2:

R: Remove multiple empty columns of character variables

旧街凉风 提交于 2019-12-28 12:06:43
问题 I have a data frame where all the variables are of character type. Many of the columns are completely empty, i.e. only the variable headers are there, but no values. Is there any way to subset out the empty columns? 回答1: If your empty columns are really empty character columns, something like the following should work. It will need to be modified if your "empty" character columns include, say, spaces. Sample data: mydf <- data.frame( A = c("a", "b"), B = c("y", ""), C = c("", ""), D = c("", "

NullReferenceException in string.IsNullOrWhiteSpace() and string.IsNullOrEmpty()

好久不见. 提交于 2019-12-25 16:32:38
问题 I'm checking the cell values of cells of a column that might or not be empty/null so I needed something to avoid a NullReferenceException . How do I do that since even with the IsNullOrWhiteSpace() and IsNullOrEmpty() I get that exception somehow. Here's part of the code I'm using: s = "Total = " + dataGridView1.Rows[0].Cells.Count + "0 = " + dataGridView1.Rows[0].Cells[0].Value.ToString() + "/n 1 = " + dataGridView1.Rows[0].Cells[1].Value.ToString() + "/n 2= " + dataGridView1.Rows[0].Cells[2

NullReferenceException in string.IsNullOrWhiteSpace() and string.IsNullOrEmpty()

会有一股神秘感。 提交于 2019-12-25 16:31:29
问题 I'm checking the cell values of cells of a column that might or not be empty/null so I needed something to avoid a NullReferenceException . How do I do that since even with the IsNullOrWhiteSpace() and IsNullOrEmpty() I get that exception somehow. Here's part of the code I'm using: s = "Total = " + dataGridView1.Rows[0].Cells.Count + "0 = " + dataGridView1.Rows[0].Cells[0].Value.ToString() + "/n 1 = " + dataGridView1.Rows[0].Cells[1].Value.ToString() + "/n 2= " + dataGridView1.Rows[0].Cells[2

string.IsNullOrEmpty() Doesn't Seem to Work on a String within a Class within a Class

夙愿已清 提交于 2019-12-24 03:07:51
问题 First off, I think I know what's going on, but I thought I'd bring this issue up here for some discussion and see if anyone has an "answer" to this other than what I'm thinking. Because, it doesn't completely make sense to me. What I found is that when creating a error log for exceptions, I was doing this and it wasn't working: catch( Exception ex ) { LogException( ex.Message ); if ( !string.IsNullOrEmpty( ex.InnerException.Message ) ) { LogInnerException( ex.InnerException.Message ); } } and

Skipping blank emails in Google Apps Script Mail Merge

丶灬走出姿态 提交于 2019-12-13 07:25:23
问题 I'm using this Simple Mail Merge Tutorial to help me create a mail merge to send students and their parents a summary of their completed community service hours. Their email addresses are in a Google Sheets doc. The script works until it hits a blank cell. Then it gives me an error that says "Invalid email: undefined" with a reference to the line in the script with the send email command. I've temporarily solved this within the spreadsheet itself by having it plug in a dummy email into any

C# String.IsNullOrEmpty: good or bad?

半腔热情 提交于 2019-12-12 09:31:19
问题 After an incident at work where I misused String.IsNullOrEmpty with a Session variable, a fellow coworker of mine now refuses to accept my usage of String.IsNullOrEmpty. After some research, apparently there's a bug listed for IsNullOrEmpty on MSDN (link) (read note at the bottom): As of April 4, 2006, there is a bug (possible in the JIT) that makes this method fail when optimizations are turned on. It is known to affect both C# and VB. More information can be found here (link). Microsoft the

Empty JSON Object check

耗尽温柔 提交于 2019-12-12 03:54:59
问题 When I console print I get value of var a as Object{}, which is empty JSON Object Using jQuery how do I check for the empty value? Thank you. 回答1: Use the jQuery function: jQuery.isEmptyObject( object ) More detailed description here: http://api.jquery.com/jQuery.isEmptyObject/ EDIT: As I always say... and insist on it. Rule number one of the programmer: "Man pages are your best friend" or the one I was slapped with in school "F1 is there for a reason" 来源: https://stackoverflow.com/questions

Skipping empty files in Gnuplot

删除回忆录丶 提交于 2019-12-08 06:42:41
问题 I am using gnuplot 4.6 . Also, I know that a similar question was asked more than a year ago here. The answer to that requires to write a small bash script. I want to know if it is possible to achieve this from within gnuplot script, especially when gnuplot-4.6 has so many cool features added. I am trying to achieve something like this : set xrange[xL:xU] set yrange[yL:yU] plot "file1.dat" using 1:2 w l lt 1 lw 1 lc 3,\ "file2.dat" using 1:2 w l lt 1 lw 1 lc 3 I am repeating the above process