VB中在文字中輸入一段字串,怎麼分別提取出各個字元給陣列

2021-04-13 01:54:23 字數 1814 閱讀 2252

1樓:新新菜鳥手

option explicit

dim a() as string

dim n as integer

private sub command1_click()redim a(len(text1.text))for n = 1 to len(text1.text)a(n) = mid(text1.

text, n, 1)print a(n)

next n

end sub

有問抄題襲再bai找du我zhi。dao

2樓:匿名使用者

lz求的是vba的答案?

選中你輸入字串的單元回

格,然後執行答

option explicit

sub subsplit()

dim strinput as stringdim stroutput() as stringdim i as integer

dim nlen as integer

strinput = selection.textnlen = len(strinput)

redim stroutput(nlen - 1) as string

for i = 0 to ubound(stroutput)stroutput(i) = mid(strinput, i + 1, 1)

debug.print stroutput(i)next

end sub

3樓:匿名使用者

你讀出的

文字為 s string

如果你能保證每行都有=號,下面**可用,你版試一下dim a() as string

a=split(s,vbcr)

dim i as integer

for i =0 to ubound(a)a(i)=split(a,"=")(1)

next

'現在的a()就是你要權的。

4樓:匿名使用者

試試copy

我的。。。

。。dim a$(), i%, ry$

ry = range("b1").valueif ry = "" then exit subredim a(len(ry) - 1)

for i = 0 to ubound(a)a(i) = mid(ry, i + 1, 1)range("b" & (15 + i)).value = a(i)next

5樓:匿名使用者

dim a(3) as string

for i=0 to 3

a(i)=mid(text1.text,i+1,1)next

這樣就可以了

6樓:邂逅的守望

a(n) = mid(ry, n, n + 1) ==》a(bain)=mid(ry,n,1)

mid(string,start,len)string 為字串du

start為第幾zhi

個字元開

dao始擷取

len 為截回

取長度答

7樓:匿名使用者

你讀出的bai文字為 s string

如果你能保證

du每行都有zhi=號,下面**可用,dao你試回一下dim a() as string

a=split(s,vbcr)

dim i as integer

for i =0 to ubound(a)a(i)=split(a,"=")(1)

next

'現在的a()就是你要答的。

vb6中字串相加,vb6中字串相加

因為你 a,b,c 三個變數定義錯誤 不應該是字串型別 而應該是 數值型 dim a as long b as long c as long vb語言中怎麼輸入加法 比如 text3.text text1.text text2.text 是字串相加,結果就是把兩個字串連起來,正確應該是text3.t...

VB中,怎樣在已知的字串中插入字元

很簡單嘛,先將原字串拆分成兩半,加入後再合上即可。dim t as string dim k as string t abcdfghijklmn k mid t,1,4 e mid t,5 這個 是將字母e插在從左向右第5個位置上。原字串是 abcdfghijklmn 插入後的字串是 abcdefg...

任意輸入字元組成字串,對該字串中的字元按ASCII碼值升序排列後輸出,程式設計實現此功能

在手機知道中已有 知道君 正確的回答,電腦中為何看不見呢 public class form1 不限制輸入的字元個數 private sub button1 click byval sender as system.object,byval e as system.eventargs handles...