From c60876d0780b2ebcc89cf9ea07910d5baeaf30db Mon Sep 17 00:00:00 2001 From: suyangzuo <50766353+suyangzuo@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:56:15 +0800 Subject: [PATCH] doc: update docs/cs.md (#514) --- docs/cs.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/cs.md b/docs/cs.md index 5914a8b..499f640 100644 --- a/docs/cs.md +++ b/docs/cs.md @@ -289,6 +289,17 @@ Console.WriteLine(multiLine); // => Content begin "Hello World!" /\n<>"" end. ### 字符串操作 +#### 字符串判空 + +```cs +string name; //空引用 +string gender = ""; //空值 + +// 使用 string.IsNullOrEmpty(字符串) 方法,返回 bool 型 +Console.WriteLine(string.IsNullOrEmpty(name)); //输出 true +Console.WriteLine(string.IsNullOrEmpty(gender)); // 输出 true +``` + #### 字符串分割 ```cs