一、Integer
Dim x As Integer
Dim y As Integer
'Dim y As Integer = 4
x = 7
y = x - 3
Console.WriteLine(y)
二、String
Dim myName As String
myName = Console.ReadLine
Console.WriteLine("您的名字" & myName)
1.字符串里用双引号 例 : "我的生活是""好的"""
2.使用空格等特殊字符 例 : "我需要的是"&vbNewLine&"新的一行" (vbTab)
3.
4.StringBuilder(比上面那个不占内存空间)
5.String的其他函数
截取:SubString(number,number)
转大写:ToUpper()
转小写:ToLower()
替换字符:Replace(旧字符,新字符)
长度统计:Length
空格剪切:
![]()
三、char
Dim names As String = "aaa"
Dim charArray() As Char = names.ToCharArray
'将字符串反转
Dim texts As String = String.Empty
For Each c In charArray.Reverse
texts &= c.ToString
Next
Console.WriteLine(texts.ToString)
四、数组
Dim numbers(4) As Integer
numbers(0) = 4
Dim numbers1() As Integer = {3, 1, 2, 1}
For Each number In numbers
Console.WriteLine(number)
Next