学习VB.NET这样一门专门面向对象的编程语言的时候,需要对诸如数据类型等这样的基础知识进行重点学习,才能充分掌握这一语言的应用技巧。这些VB.NET基本数据类型也象类一样拥有各自的方法和属性,熟练运用它们能让你的程序更优雅和更有面向对象的味道。

VB.NET基本数据类型的重要方法和属性举例
- 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基本数据类型之整数操作
- i = Int32.Parse("¥123",
 
Globalization.NumberStyles.
AllowCurrencySymbol) '123- i = Int32.MaxValue '2147483647
 - i = Int32.MinValue '-2147483648
 - by = Byte.Parse("1") '1
 
VB.NET基本数据类型之浮点数操作
- d = Double.Positive
 
Infinity '正无穷大- d = Double.Epsilon
 
'4.94065645841247E-324
VB.NET基本数据类型之布尔操作
- s = Boolean.TrueString 'True
 
VB.NET基本数据类型之日期操作
- 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转换
- Char.ToLower(c)
 - Char.ToUpper(c)
 
VB.NET基本数据类型之字符串操作
- cc = s.ToCharArray()
 - sss = s.Split(",")
 - ss = s.Substring(5, 3)
 - ss = s.Trim()
 
                分享标题:VB.NET基本数据类型实用经验总结
                
                网页地址:http://www.csdahua.cn/qtweb/news15/329715.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网