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

 

        '整数操作

        i = Int32.Parse("123", Globalization.NumberStyles.AllowCurrencySymbol) '123

        i = Int32.MaxValue '2147483647

        i = Int32.MinValue '-2147483648

        by = Byte.Parse("1") '1

        '浮点数操作

        d = Double.PositiveInfinity '正无穷大

        d = Double.Epsilon '4.94065645841247E-324

        '布尔操作

        s = Boolean.TrueString 'True

        '日期操作

        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)

        '字符串操作

        cc = s.ToCharArray()

        ss = s.Split(",")

        s = s.Substring(5, 3)

        s = s.Trim()

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值