vb6的字符截取mid,left,right在vb.net中的替代
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim str As String = "我爱变形金刚"'从索引值为二的字符开始,取2个字符,同mid(str,2,2) 变形
Debug.Print(str.Substring(2, 2))
'从索引值为三的字符开始取到最后所有字符,同mid(str,3) 形金刚
Debug.Print(str.Substring(3))
'从索引值为零的字符开始,取3个字符字符,同left(str,3) 我爱变
Debug.Print(str.Substring(0, 3))
'从右边未尾开始,取3个字符,同right(str,3) 形金刚
Debug.Print(str.Substring(str.Length - 3))
End Sub
出处:http://blog.sina.com.cn/s/blog_49f7bc810102w0nx.html
本文介绍如何将VB6中的字符截取函数mid、left、right转换为VB.NET中的Substring方法使用,并通过示例代码展示具体的实现过程。
1483

被折叠的 条评论
为什么被折叠?



