「Unity/Csharp/文字操作」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==文字の長さ== String name = "abcdef"; name.Length; // 6 ==文字の切り取り== String name = "abcdef"; name = name.Substring (name.Length - 2, 2); // ef」) |
|||
| 行6: | 行6: | ||
String name = "abcdef"; | String name = "abcdef"; | ||
name = name.Substring (name.Length - 2, 2); // ef | name = name.Substring (name.Length - 2, 2); // ef | ||
| + | |||
| + | ==検索== | ||
| + | if (a.IndexOf("検索文字列") == -1) { | ||
| + | // no hit | ||
| + | } else { | ||
| + | // hit | ||
| + | } | ||
2017年9月22日 (金) 07:31時点における版
文字の長さ
String name = "abcdef"; name.Length; // 6
文字の切り取り
String name = "abcdef"; name = name.Substring (name.Length - 2, 2); // ef
検索
if (a.IndexOf("検索文字列") == -1) {
// no hit
} else {
// hit
}
