1

我需要检查“4.1.1.1”(示例)是否大于“4.1.4”(在这种情况下为假),当“整数”中有多个小数点时,如何在 VB.Net 中执行此操作?

4

1 回答 1

1

我不是vb专家。但也许是这样的:

测试值

dim str as string="4.1.1.1"
dim str2 as string="4.1.4"

str 大于 str2

dim result as boolean=( _ 
from split in str.Split(".").Select(function(s,i) New With {s,i}) _ 
join split2 in str2.Split(".").Select(function(s,i) New With {s,i}) _ 
on split.i equals split2.i _ 
where cint(split.s)<cint(split2.s)
select 1).Any()

str2 比 str 大

dim result as boolean=( _ 
from split in str.Split(".").Select(function(s,i) New With {s,i}) _ 
join split2 in str2.Split(".").Select(function(s,i) New With {s,i}) _ 
on split.i equals split2.i _ 
where cint(split.s)>cint(split2.s)
select 1).Any()
于 2012-04-07T22:23:43.060 回答