C#文字列StartsWith
EndsWith

StartsWith文字列

IndexOf

指定した文字列で始まるかどうかを確認します。

構文

str.StartsWith(value, comparisonType?)

使用例

下記の値を入力するとサンプルに即時反映されます。

string
url
isHttps
StartsWith
Console
WriteLine
string url = "https://example.com";
bool isHttps = url.StartsWith("https");
Console.WriteLine(isHttps);   // True