1樓:
private sub 轉換按鈕_click()dim txt, s as string, c as stringdim i as integer
txt = split(text1,".")for i = 0 to ubound(txt)txt(i) = trim(txt(i))if txt(i)<>"" then
if c like "[a-za-z]" thenif c like "[a-z]" thenc = ucase(left(txt(i),1))else
c = left(txt(i),1))
end if
s = s & c
if c like "[a-z] then mid(txt(i), 1, 1) = c
end if
end if
next
text2 = s
text1 = rtrim(join(txt, ". "))end sub
2樓:匿名使用者
option explicit
private sub command1_click()
dim mystr as string
mystr = myfunction(text1.text, vbcrlf)
mystr = myfunction(mystr, ".")
text2.text = mystr
end sub
private function myfunction(mystr as string, mychr as string) as string
dim mytxt() as string, mytemp as string, myoutput as string, i as integer, j as integer, mysp as string
mytxt = split(mystr, mychr)
for i = 0 to ubound(mytxt)
mytemp = mytxt(i)
mysp = ""
for j = 1 to len(mytemp)
if mid(mytemp, j, 1) <> " " then exit for
mysp = mysp & " "
next
mytemp = trim(mytemp)
mytemp = mysp & ucase(left(mytemp, 1)) & mid(mytemp, 2)
myoutput = myoutput & mytemp & mychr
next
myfunction = myoutput
end function
VB迴圈語句,vb中的迴圈語句
for 迴圈變數 初賦值 to 終值 step 步長 next 迴圈變數 在預設情況下,step被設為 1 可以省略,step也可以設為負值,例如 dim a 0 for i 1 to 10 a a i next i 這是乙個最簡單的累加器的例子,把1到10累加在一起,然後賦值給 a 這樣的效果和上...
vb中的for語句,VB中的For語句
一 vb中的for語句格式 for 迴圈變數 初值 to 終值 step步長 迴圈體 exit for next 迴圈變數 二 vb中的for語句功能 當迴圈變數的值在初值到終值範圍內時,執行一次迴圈體中的語句塊,並使初值增加乙個步長。當迴圈變數的值不在初值到終值範圍內時,就退出迴圈,執行next後...
vb中if 語句的運用,VB中if 語句的運用
你的理解不對。第乙個if語句執行後,m取的是a,b中的最大值 第二個if語句執行後,m取的是c,m中的最大值 當c m為假,m還是原來的m,不需些else子句。所以最後text4.text m,顯示的是a,b,c三者中的最大數。if 語句有幾種型式,如果直接寫成 if 判斷 theh 表示式 這時是...
vb程式設計語句求注釋,VB程式設計語句求注釋
按照vb語法,注釋用 標出 private option1 click index as integer 過程開始,過程為私有許可權.名字是option1 click,引數是index 引數型別是整數 for i 0 to 3 迴圈開始,從i 0到i 3,迴圈體執行4次 if index i the...
vb的if語句中的問題,關於VB中IF語句中的理解問題
這個就是正確的 if text1.text thenmsgbox 請輸入內容 end if if len text1.text 0 and text1.text 正確內容 then msgbox 請輸入乙個正確內容 end if if text1.text 正確內容 thenmsgbox 通過 en...