首页 > 编程 > .NET > 正文

VB.Net学习笔记(面向对象的基本数据类型)

2024-07-10 13:01:35
字体:
来源:转载
供稿:网友
这些基本类型也象类一样拥有各自的方法和属性,熟练运用它们能让你的程序更优雅和更有面向对象的味道。



基本类型的重要方法和属性举例

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()



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表