VB.NET基本數(shù)據(jù)類型實(shí)用經(jīng)驗(yàn)總結(jié)
學(xué)習(xí)VB.NET這樣一門專門面向?qū)ο蟮木幊陶Z(yǔ)言的時(shí)候,需要對(duì)諸如數(shù)據(jù)類型等這樣的基礎(chǔ)知識(shí)進(jìn)行重點(diǎn)學(xué)習(xí),才能充分掌握這一語(yǔ)言的應(yīng)用技巧。這些VB.NET基本數(shù)據(jù)類型也象類一樣擁有各自的方法和屬性,熟練運(yùn)用它們能讓你的程序更優(yōu)雅和更有面向?qū)ο蟮奈兜馈?/p>
VB.NET基本數(shù)據(jù)類型的重要方法和屬性舉例
- Dim i As Int32
- Dim s As String
- Dim ss() As String
- Dim by As Byte
- Dim d As Double
- Dim b As Boolean
- Dim da As Date
- Dim c As Char
- Dim cc() As Char
VB.NET基本數(shù)據(jù)類型之整數(shù)操作
- i = Int32.Parse("¥123",
Globalization.NumberStyles.
AllowCurrencySymbol) '123- i = Int32.MaxValue '2147483647
- i = Int32.MinValue '-2147483648
- by = Byte.Parse("1") '1
VB.NET基本數(shù)據(jù)類型之浮點(diǎn)數(shù)操作
- d = Double.Positive
Infinity '正無(wú)窮大- d = Double.Epsilon
'4.94065645841247E-324
VB.NET基本數(shù)據(jù)類型之布爾操作
- s = Boolean.TrueString 'True
VB.NET基本數(shù)據(jù)類型之日期操作
- da = Date.MaxValue
- '9999-12-31 23:59:59
- da = Date.MinValue
- '0:00:00
- da = Date.Now
- '2004-5-7 13:17:35
- b = Date.IsLeapYear(2004)
- 'True
- i = Date.DaysInMonth(2004, 5)
- '31
以下方法用于判斷字符的特性
- Char.IsControl(c)
- Char.IsDigit(c)
- Char.IsLetter(c)
- Char.IsLetterOrDigit(c)
- Char.IsLower(c)
- Char.IsNumber(c)
- Char.IsPunctuation(c)
- Char.IsSeparator(c)
- Char.IsSurrogate(c)
- Char.IsSymbol(c)
- Char.IsWhiteSpace(c)
- Char.IsUpper(c)
Char轉(zhuǎn)換
- Char.ToLower(c)
- Char.ToUpper(c)
VB.NET基本數(shù)據(jù)類型之字符串操作
- cc = s.ToCharArray()
- sss = s.Split(",")
- ss = s.Substring(5, 3)
- ss = s.Trim()
【編輯推薦】