{"id":153,"date":"2013-12-12T11:34:07","date_gmt":"2013-12-12T02:34:07","guid":{"rendered":"http:\/\/gomocool.net\/gomokulog\/?p=153"},"modified":"2013-12-12T12:14:45","modified_gmt":"2013-12-12T03:14:45","slug":"c%e3%81%aestring%e3%81%a7%e6%96%87%e5%ad%97%e5%88%97%e6%a4%9c%e7%b4%a2","status":"publish","type":"post","link":"https:\/\/gomokulog.gomocool.net\/?p=153","title":{"rendered":"C#\u306eString\u3067\u6587\u5b57\u5217\u691c\u7d22"},"content":{"rendered":"<p>C#\u306eString\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u306f\u3001\u4e8c\u3064\u3042\u308b\u3002\u3000(C#2.0\u4ee5\u964d)<\/p>\n<p>\u4e00\u3064\u306f\u3001\u4ee5\u524d\u304b\u3089\u4f7f\u308f\u308c\u307b\u304b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e\u3067\u3082\u304a\u76ee\u306b\u304b\u304b\u308b\u3001IndexOf\u3067\u30d2\u30c3\u30c8\u3057\u305f\u6587\u5b57\u5217\u306e\u5148\u982d\u4f4d\u7f6e\u3092\u8fd4\u3059\u3082\u306e\u3002<br \/>\nHellow\u3067ell\u3092\u63a2\u3059\u3068\u30011\u304c\u5e30\u308b\u3002\u306a\u304b\u3063\u305f\u3089-1\u304c\u5e30\u308b\u3002<\/p>\n<p>\u3082\u3046\u4e00\u3064\u306f\u3001C#2.0\u3067\u8ffd\u52a0\u3055\u308c\u305f\u3001Contains \u3002<br \/>\n\u3053\u3061\u3089\u306f\u3001\u6587\u5b57\u5217\u304c\u3042\u308b\u304b\u7121\u3044\u304b\u3067true\u304bfalse\u3092\u8fd4\u3059\u3002<\/p>\n<p>Contains\u306e\u5185\u90e8\u7684\u306b\u306fIndexOf\u3068\u540c\u3058\u3053\u3068\u3092\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u540c\u3058\u52d5\u4f5c\u304c\u53ef\u80fd\u3002<\/p>\n<pre class=\"lang:c# decode:true\" title=\"Example\">String str = \"Hellow\";\r\nString word = \"ell\";\r\nif (str.IndexOf(word) &gt; -1)\r\n{\r\n    MessageBox.Show(\"Hit\");\r\n}\r\n\r\nif (str.Contains(word))\r\n{\r\n      MessageBox.Show(\"Hit\");\r\n}<\/pre>\n<p>\u691c\u7d22\u3057\u305f\u6587\u5b57\u5217\u304b\u3089\u3001Substring\u7b49\u3067\u6587\u5b57\u5217\u3092\u52a0\u5de5\u3059\u308b\u5834\u5408\u306b\u306f\u3001IndexOf\u304c\u5fc5\u8981\u3060\u304c\u3001\u5358\u7d14\u306a\u6761\u4ef6\u5206\u5c90\u3068\u3057\u3066\u306f\u3001Contains\u3092\u4f7f\u7528\u3057\u305f\u307b\u3046\u304c\u3001\u9593\u9055\u3044\u3082\u5c11\u306a\u304f\u30b3\u30fc\u30c9\u7684\u306b\u3082\u8aad\u307f\u3084\u3059\u3044\u6c17\u304c\u3059\u308b\u3002Contains = \u542b\u3080 \u3060\u3057\u306d\u3002<\/p>\n<p>\u306a\u304a\u3001\u3069\u3061\u3089\u3082\u691c\u7d22\u6587\u5b57\u5217\u306b&#8221;&#8221;\u3068\u7a7a\u6587\u5b57\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u5148\u982d\u306b\u7a7a\u6587\u5b57\u3092\u767a\u898b\u3057\u305f\u3068\u3057\u3066IndexOf\u306a\u30890\u3001Contains\u306a\u3089true\u3092\u8fd4\u3059\u3002<br \/>\n\u691c\u7d22\u6587\u5b57\u5217\u306b&#8221;&#8221;\u304c\u5165\u308b\u3068\u3001\u4e88\u671f\u305b\u306c\u884c\u52d5\u3092\u8d77\u3053\u3059\u30d0\u30b0\u306e\u5143\u306b\u306a\u308a\u304b\u306d\u306a\u3044\u3002<br \/>\n(CSV\u30d5\u30a1\u30a4\u30eb\u7b49\u306e\u7279\u5b9a\u6587\u5b57\u3067\u5206\u5272\u3057\u305f\u3082\u306e\u3092\u5207\u3063\u305f\u3082\u306e\u304b\u3089\u691c\u7d22\u3068\u304b\u30fb\u30fb)<br \/>\n\u306a\u306e\u3067\u3001\u691c\u7d22\u6587\u5b57\u304c\u7a7a\u6587\u5b57\u304b\u3069\u3046\u304b\u7b49\u3092\u5224\u65ad\u3059\u308b\u51e6\u7406String.IsNullOrEmpty\u304bString.IsNullOrWhiteSpace\u7b49\u3092\u5165\u308c\u305f\u307b\u3046\u304c\u3088\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<pre class=\"lang:c# decode:true\" title=\"Example2\">if (string.IsNullOrWhiteSpace(word) ? false : str.Contains(word))\r\n{\r\n      MessageBox.Show(\"Hit\");\r\n}<\/pre>\n<p>\u4ed6\u306b\u3082\u3001Contains\u3068\u4f3c\u305f\u611f\u3058\u3067\u3001StartsWith\u3068EndsWith\u3068\u3044\u3046\u306e\u304c\u3042\u308a\u3001\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3067\u59cb\u307e\u308b\u304b\u3001\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3067\u7d42\u308f\u308b\u304b\u304c\u3001bool\u3067\u5e30\u308b\u306e\u3067\u3001\u72b6\u6cc1\u306b\u3088\u3063\u3066\u306f\u4fbf\u5229\u304b\u3082\u3002<br \/>\n\u305f\u3068\u3048\u3070\u3001\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u304b\u3089\u62e1\u5f35\u5b50\u3067\u30d2\u30c3\u30c8\u3059\u308b\u3082\u306e\u3092\u63a2\u3059\u3068\u304b\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C#\u306eString\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u306f\u3001\u4e8c\u3064\u3042\u308b\u3002\u3000(C#2.0\u4ee5\u964d) \u4e00\u3064\u306f\u3001\u4ee5\u524d\u304b\u3089\u4f7f\u308f\u308c\u307b\u304b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e\u3067\u3082\u304a\u76ee\u306b\u304b\u304b\u308b\u3001IndexOf\u3067\u30d2\u30c3\u30c8\u3057\u305f\u6587\u5b57\u5217\u306e\u5148\u982d\u4f4d\u7f6e\u3092\u8fd4\u3059\u3082\u306e\u3002 Hellow\u3067ell\u3092\u63a2\u3059\u3068\u30011\u304c\u5e30&hellip;  <a href=\"https:\/\/gomokulog.gomocool.net\/?p=153\" class=\"more-link\">more <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","hentry","category-csharp"],"_links":{"self":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=153"}],"version-history":[{"count":4,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":157,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions\/157"}],"wp:attachment":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}