深入浅出ASP.NET程序设计-源代码
书籍语言: 简体中文
书籍类型: 程序设计
授权方式: 免费软件
书籍大小: 627 KB
源代码在线查看: ch12-02-05.aspx
Ch12-02-05.aspx System.String字符串类的字符串数据转换
System.String字符串类的字符串数据转换
' 声明字符串变量
Dim blnA As Boolean = False
Dim strA As String = "400"
Dim strB As String = "500"
Dim strC As String = "True"
Dim strD As String = "深入浅出 ASP.NET 程序设计 陈峰棋 编著"
Dim intA, intB As Integer
' 转换成字符串
Response.Write("将布尔值False转换成字符串:" & blnA.ToString() & "")
intA = Convert.ToInt32(strA)
intB = Convert.ToInt32(strB)
Response.Write("将两字符串转换成整数后的相加结果:" & intA + intB & "")
Response.Write("将字符串strA转换成布尔值: " & Convert.ToBoolean(strC) & "")
' 声明字符串数组
Dim SplitWord() As String
SplitWord = strD.Split(" ")
' 使用循环显示数组的内容
Response.Write("数组的原始字符串为:" & strD & "")
For intA = SplitWord.GetLowerBound(0) To SplitWord.GetUpperBound(0)
Response.Write("数组元素 " & intA & " 的内容为:" & SplitWord(intA) & "" )
Next
%>