StartsWith
文字列を先頭一致で判定する
' 変数を宣言
Dim TTT As String = "testsample"
' 文字列を先頭から一致するか判断する
If TTT.StartsWith("test") Then
Console.WriteLine("文字列は先頭一致します")
MessageBox.Show("文字列は先頭一致します")
End If
EndsWith
文字列を後方一致で判定する
' 変数を宣言
Dim TTT As String = "testsample"
' 文字列を末尾から一致するか判断する
If TTT.EndsWith("sample") Then
Console.WriteLine("文字列は後方一致します")
MessageBox.Show("文字列は後方一致します")
End If
コメント
コメントを投稿