怎樣用VB來提取文字中的字串,怎樣用VB來提取文字中的字串

2021-03-04 09:00:54 字數 493 閱讀 9808

1樓:匿名使用者

dim tmpstr as string

tmpstr = text1

tmpstr = replace(tmpstr, "-", "")tmpstr = replace(tmpstr, "/", "")變數"tmpstr"就是你想要的效果!

函式"replace"的作用,是把一些你回不想要的字元進行答替換.

2樓:伊人尤在

public function extract_num(mystr as string) as string

extract_num = ""

for i = 1 to len(mystr)if isnumeric(mid(mystr, i, 1)) then

extract_num = extract_num + mid(mystr, i, 1)

end if

next i

end function

excel如何提取字串中的一段字元

left substitute a1,find substitute a1,1 假設你的資料在a列,那你在b1中輸入以下公式並下拉即可 mid a1,find a1 1,find a1 find a1 1 可以使用mid函式提取乙個字串中的一段字元。mid 用來返回文字字串中從指定位置開始的特定數目...

VB6 0中如何使得字串中的某字元選中高亮並使這個字元字型變大

使用richtextbox控制項 private sub command1 click richtextbox1.selstart 3 要高亮的起始字元數 richtextbox1.sellength 5 要高亮的字元數 richtextbox1.selcolor vbred 顏色richtextb...

VB如何得到字串中某個字元的值

如果你的 是固定的位置的話,除了上面兩位的方法之外,還可以用left和rigth 例 str 1 1977 01 01 19 22 num right left str,2 1 sub getnum dim string1 as stringdim strval as string dim i as...