I have this program I am making in C#, and I need it to filter out all of the strings that the user sets. What I am trying to have it do is find a command that is like:
if (exampleString == anythingButNull);
If anyone can help me with a command or something that can replace the "anythingButNull" that would be very helpful to me. Thanks!
Start by asking the question - what do I really want to exclude?
Try this if you wish to exclude nulls and empty strings
if (!string.IsNullOrEmpty(exampleString))
This one excludes white space as well
if (!string.IsNullOrWhiteSpace(exampleString))
In the case you really do just want a pure null
exclusion, it's as simple as
if(exampleString != null)
References:
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다