VB.Net Split的4种使用方法
来源:百度文库 编辑:神马文学网 时间:2024/10/01 08:43:46
4个关于split的实例
1. 简单的split分割字符串
首先我们拿了一个带多个空格的字符串来做分割. 我们分配一个New Char() array 保存为String() array 来储存我们例子中的那些分割后的单词.最后,我们用loop循环来遍历和显示这些分割后的字母集合.
=== Program that uses Split on String (VB.NET) ===Module Module1Sub Main()' We want to split this input stringDim s As String = "Our website address is www.lob.cn"' Split string based on spacesDim words As String() = s.Split(New Char() {" "c})' Use For Each loop over words and display themDim word As StringFor Each word In wordsConsole.WriteLine(word)NextEnd SubEnd Module=== Output of the program ===Our
website
address
is
www.lob.cn
2. 分割一个完整文件路径
Here we see how you can Split a file system path into separate parts using Visual Basic .NET. We use a New Char() array with one string, "\""c, and then loop through and display the results.
=== Program that splits file path (VB.NET) ===Module Module1Sub Main()' The file system path we need to splitDim s As String = "C:\Users\Sam\Documents\Perls\乐博网"' Split the string on the backslash characterDim parts As String() = s.Split(New Char() {"\"c})' Loop through result strings with For EachDim part As StringFor Each part In partsConsole.WriteLine(part)NextEnd SubEnd Module=== Output of the program ===C:UsersSamDocumentsPerls乐博网
VB.Net Split的4种使用方法
VB.Net IndexOf的6种使用方法
VB.NET计算数字相关函数使用方法
VB MSFlexGrid控件的几种简单的使用方法
VB MSFlexGrid控件的几种简单的使用方法!
VB MSFlexGrid控件的几种简单的使用方法
vb.net的ListBox控件
vb.net的Combobox控件
vb.net的多维数组
VB.NET创建快捷方式的两种方法
VB.NET创建快捷方式的两种方法
js的split用法
Hashtable 构造函数 ()的VB.NET例子
VB.Net处理文本文件的方法
vb.net的Combobox控件1
vb.net入门--ErrorProvider 组件的使用
vb.net入门--NotifyIcon 组件的使用
Vb.net 取程序运行的绝对路径
VB.Net自动创建数据库的实例
VB.NET实现文字的流动框
vb.net的Combobox控件_翼心网
VB.NET 入门教程
VB.NET字符串函数
vb.net控件