vb.net 截取字符串
2007-08-24 17:54
190 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
Private Sub Test_Load()Sub Test_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim str As String = _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
"中abc中国"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
' 1 2345 6 string count of vb6
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
' 0 1234 5 string count of .net
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text = ""
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'left
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim leftStrVB As String = Microsoft.VisualBasic.Left(str, 5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim leftStr As String = str.Substring(0, 5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "leftStrVB is " & leftStrVB & vbCrLf 'leftStrVB is 中abc中
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "leftStr is " & leftStr & vbCrLf 'leftStr is 中abc中
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'center
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim centerStrVB As String = Microsoft.VisualBasic.Mid(str, 2, 4)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim centerStr As String = str.Substring(1, 4)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "centerStrVB is " & centerStrVB & vbCrLf 'centerStrVB is abc中
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "centerStr is " & centerStr & vbCrLf 'centerStr is abc中
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'right
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim rightStrVB As String = Microsoft.VisualBasic.Right(str, 5)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Dim rightStr As String = str.Substring(1)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "rightStrVB is " & rightStrVB & vbCrLf 'rightStrVB is abc中国
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Label1.Text &= "rightStr is " & rightStr & vbCrLf 'rightStr is abc中国
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
End Sub
相关文章推荐
- 【原创】全角、半角混合字符串截取方法(VB.NET版)
- VB.NET按字节截取字符串
- C#和VB.net实现根据字节数截取字符串
- vb(不是vb.net)字符串多行书写
- asp.net 截取字符串代码
- asp.net 将指定字符串按指定长度进行截取并用其他字符串替换方法
- asp.net在前台将指定字符串按指定长度进行截取并用其他字符串替换方法
- 自己写的加密字符串、数字、日期的类(VB.net)
- ASP.net:截取固定长度字符串显示在页面,多余部分显示为省略号
- 【VB.NET】字符串数组长度排序算法
- Asp.Net截取字符串输出
- asp.net(c#) datelist DataGrid 中截取字符串加"..." 和 鼠标放上去字符全部显示
- asp.net(c#) datelist DataGrid 中截取字符串加"..." 和 鼠标放上去字符全部显示
- [VB.NET源码]39_替换字符串
- ASP.net:截取固定长度字符串显示在页面,多余部分显示为省略号
- asp.net 安全的截取指定长度的html或者ubb字符串
- asp.net截取字符串方法
- vb6的字符截取mid,left,right在vb.net中的替代
- VB 汉字字符串的截取LEN、LEFT、RIGHT