VB.Net几个函数split(),ubound(),lbound(),instr(),mid(),Format()与Round()
来源:互联网 发布:网络接口接线法 编辑:程序博客网 时间:2024/05/16 08:44
1.Split(包t(包含子字符串和分隔符的字符串表达式,[分隔符],[要返回的子字符串数],[数字值表示判别子字符串时使用的比较方式]),[]部分为可选部分。该函数返回一个以零为下标的一维数组,它包含指定数目的子字符串。
例:
dim xx as variant
xx=split("hello world"," ")'将hello world 分隔为hello和world
text1.text= xx(0) '返回hello
text2.text=xx(1) '返回world
2.Ubound(数组名),该函数返回一个 Long 型数据,其值为指定的数组维可用的最大下标
Lbound(数组名),返回一个 Long 型数据,其值为指定数组维可用的最小下标。
例:
dim xx as variant
xx=split("hello world"," ")
text1.text=ubound(xx) '返回1
text2.text=lbound(xx) ‘返回0
3.Instr([start, ]string1, string2),该函数返回 Variant (Long),指定一字符串(string2)在另一字符串中(string1)最先出现的位置,如果没有找到返回0。[start,]为可选参数,表示搜索的开始位置。
例:
dim xx as string
xx="hello world"
text1.text=instr(xx,"o") '返回5
text2.text=instr(6,xx,"o") '返回8,从第6个字符开始查找
4.Mid(string, start[, length]),返回Variant (String),其中包含字符串(string)中指定长度[,length]的字符,start为开始位置。其中的[,length]为可选参数不指定长度,则返回start后的所有字符。
例:
dim xx as sting
xx="hello world"
text1.text=mid(xx,1,5)'返回hello
text2.text=mid(xx,1) '返回hello world
例:
dim xx as variant
xx=split("hello world"," ")'将hello world 分隔为hello和world
text1.text= xx(0) '返回hello
text2.text=xx(1) '返回world
2.Ubound(数组名),该函数返回一个 Long 型数据,其值为指定的数组维可用的最大下标
Lbound(数组名),返回一个 Long 型数据,其值为指定数组维可用的最小下标。
例:
dim xx as variant
xx=split("hello world"," ")
text1.text=ubound(xx) '返回1
text2.text=lbound(xx) ‘返回0
3.Instr([start, ]string1, string2),该函数返回 Variant (Long),指定一字符串(string2)在另一字符串中(string1)最先出现的位置,如果没有找到返回0。[start,]为可选参数,表示搜索的开始位置。
例:
dim xx as string
xx="hello world"
text1.text=instr(xx,"o") '返回5
text2.text=instr(6,xx,"o") '返回8,从第6个字符开始查找
4.Mid(string, start[, length]),返回Variant (String),其中包含字符串(string)中指定长度[,length]的字符,start为开始位置。其中的[,length]为可选参数不指定长度,则返回start后的所有字符。
例:
dim xx as sting
xx="hello world"
text1.text=mid(xx,1,5)'返回hello
text2.text=mid(xx,1) '返回hello world
5.Format()與Round()函數
Dim str As Double = 12.345
MsgBox(Format(str, "0.00")) '=12.35
MsgBox(Math.Round(str, 2)) '=12.34
Dim str As Double = 12.345
MsgBox(Format(str, "0.00")) '=12.35
MsgBox(Math.Round(str, 2)) '=12.34
- VB.Net几个函数split(),ubound(),lbound(),instr(),mid(),Format()与Round()
- Visual Basci中的几个函数split(),ubound(),lbound(),instr(),mid().
- InStr Split UBound 几个vb函数
- asp数组函数LBound 、UBound和Split
- ASP,VBScript常用的内置函数,lbound(),ubound(),int(),fix(),rnd(),instr(),instrrec(),,
- VB.NET Mid函数用法
- VB.net版机房收费系统——Trim函数&Round函数&Mid函数
- vb:instr(),mid() c#:indexof(),substring()
- VB-Instr、Str、Replace、Format
- VB InStr函数
- 与VB对应的字符串函数之一:Instr, InstrRev
- C#中的Asc、Chr、CStr、InStr、Mid函数
- access string 字符串处理函数Mid(), Left(), inStr
- instr,left,mid 定位、取内容(字符串)函数
- vb.net split用法
- VBS:LBound()函数
- 【软件自动化测试 - VBScript 6】== Example of Split, Instr, Mid functions
- VB中的Split函数
- .net Chart 必备组件 打包安装
- [C#] 我的log4net使用手册(完善中)
- 人生应该记住的16句话[良言]
- 智慧型能源家庭管理终端
- XtraGrid ControlGrid绑定及部分属性设置
- VB.Net几个函数split(),ubound(),lbound(),instr(),mid(),Format()与Round()
- 数学符号的读法
- COM 组件设计与应用(五) 用 ATL 写第一个组件
- Vss2005 配置(转)
- IBM 3650服务器上安装windows 2003 server报"ql2300.sys"错误
- The latest Microsoft 70-536 from exam4actual (III)
- sscanf函数用法详解
- BPEL的基本思想
- SQLite 移植