Dim A As String, B As String
創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),巨野企業(yè)網(wǎng)站建設(shè),巨野品牌網(wǎng)站建設(shè),網(wǎng)站定制,巨野網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,巨野網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
A = "123456"
B = "123456"
If A = B Then GoTo xiangdeng
MsgBox "不相等"
GoTo buxiangdeng
xiangdeng:
MsgBox "相等"
buxiangdeng:
vb.net規(guī)定如果要比較字符串,不能用“=”,strcomp(str1,str2,n)或者string.compare(str1,str2)
例如:
Dim a As String = "c"
Dim b As String = "c"
Dim n As Integer = String.Compare(a, b)
If n = 0 Then
MsgBox("=")
Else
MsgBox("")
End If
用 Like
% = 任意數(shù)量的字符
?= 單個(gè)字符
類似簡易的正規(guī)則比對。
具體可參照MSDN
例:(以下代碼可以直接放到程序里執(zhí)行)
dim str as string
str = "abc123"
if str like "a%" then msgbox "yes"
if str like "%a%2%" then msgbox "yes"
if str like "%3" then msgbox "yes"
if str like "%3?" = false then msgbox "no"