vb.net String.EndsWith方法重载的四种方法实例
时间: 2023-12-10 17:41:52 浏览: 36
以下是 VB.NET 中 String.EndsWith 方法的四种重载方法的示例:
1. EndsWith(String):确定此字符串实例的结尾是否与指定的字符串匹配。
```
Dim str As String = "Hello World!"
Dim endsWith As Boolean = str.EndsWith("!")
```
2. EndsWith(String, StringComparison):确定此字符串实例的结尾是否与指定的字符串匹配,并使用指定的比较选项进行比较。
```
Dim str As String = "Hello World!"
Dim endsWith As Boolean = str.EndsWith("!", StringComparison.CurrentCultureIgnoreCase)
```
3. EndsWith(Char):确定此字符串实例的结尾是否与指定的字符匹配。
```
Dim str As String = "Hello World!"
Dim endsWith As Boolean = str.EndsWith("!")
```
4. EndsWith(Char, StringComparison):确定此字符串实例的结尾是否与指定的字符匹配,并使用指定的比较选项进行比较。
```
Dim str As String = "Hello World!"
Dim endsWith As Boolean = str.EndsWith("!", StringComparison.CurrentCultureIgnoreCase)
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)