請問一ASP中split()函數的使用 (20點)

seq="TTCGTTTCGTCGCGTTTTTT"

我想將其切割後放到seqarray變成下列結果

seqarray(0)="TT"

seqarray(1)="TTT"

seqarray(2)="T"

seqarray(3)=""<==此空格代表有兩個單位的CG

seqarray(4)="TTTTTT"

我知道用Split(seq, "CG")

可是結果會變成

seqarray(0)=TT

seqarray(1)=""

seqarray(2)=TTT

seqarray(3)=""

seqarray(4)=T

seqarray(5)=""

seqarray(6)=""

seqarray(7)=TTTTTT

勞煩大家了@@"

有看不懂的再跟我說

Update:

附帶一提 seq會隨輸入而改變!

Update 2:

怕大家看不懂 在說明一下

seqarray(3)=""<==此空格代表有兩個單位的CG

若seq="TCGCGCGT"則

seqarray(0)=T

seqarray(1)=""

seqarray(2)=""

seqarray(3)=T

3 Answers

Rating
  • Lv 6
    1 decade ago
    Favorite Answer

    我也是看過這樣的問題

    應該還是找不到答案所致

    我以我的寫法做出來就已經可以了

    seq="TTCGTTTCGTCGCGTTTTTT"

    s = split(seq, "CG", -1, 1)

    Response.Write UBound(s) & "<BR>"

    For j = 0 to UBound(s)

    Response.Write j & ":" & s(j) & "<BR>"

    Next

    陣列長度只有5個,你卻有8個

    請把程式碼貼出來看看吧

  • 1 decade ago

    因為我在確認perl和asp中的split函數其功能是否一樣

    不過繞了一大圈 結果是一樣@@" 勞煩大家了

  • 1 decade ago

    為什麼同樣問題, 重複一直問呢?

Still have questions? Get your answers by asking now.