當前位置:編程學習大全網 - 編程軟體 - VB編程實現text1字符串倒序排列text2中

VB編程實現text1字符串倒序排列text2中

已經按妳的要求修改過了。有兩點需要說明:

1、可以把Form_Load去掉不會出現任何問題,但是前提是妳需要保持輸入內容的格式,如果格式不正確則不會得到正確的結果。

2、行數可以任意增加,每壹行的數字個數可以任意增加,前提還是要[保持格式正確]。

好了,現在發給妳:

Private?Sub?Command1_Click()

Dim?T1?As?String

Dim?STR0?As?String,?Str1?As?String

Dim?N?As?Integer

Dim?I?As?Integer,?J?As?Integer,?K?As?Integer

Dim?A?As?Variant

STR0?=?vbCrLf

T1?=?Text1.Text

Do?While?Len(T1)?>?0

N?=?InStr(T1,?STR0)

If?N?=?0?Then

Str1?=?T1

T1?=?""

Else

Str1?=?Left(T1,?N?-?1)

T1?=?Right(T1,?Len(T1)?-?N?-?1)

End?If

A?=?Split(Str1,?"?")

K?=?(UBound(A)?+?1)?\?4

If?(UBound(A)?+?1)?Mod?4?<>?0?Then?K?=?K?+?1

Text2.Text?=?Text2.Text?&?"a[0]?=?0x00"?&?Format(UBound(A)?+?1,?"00")?&?"3902"?&?STR0

For?I?=?0?To?K?-?1

Text2.Text?=?Text2.Text?&?"a["?&?I?+?1?&?"]?=?0x"

For?J?=?3?To?0?Step?-1

If?I?*?4?+?J?>?UBound(A)?Then

Text2.Text?=?Text2.Text?&?"00"

Else

Text2.Text?=?Text2.Text?&?A(I?*?4?+?J)

End?If

Next

Text2.Text?=?Text2.Text?&?STR0

Next

Text2.Text?=?Text2.Text?&?"dsi_set_cmdq(&data_array,?"?&?K?+?1?&?",?1)"?&?STR0

Loop

End?Sub

Private?Sub?Form_Load()

Text2.Text?=?""

Text1.Text?=?"12?AB?CD?5c?76?88?c2"?&?vbCrLf?&?"99?23?A3?44"

End?Sub

已經運行過,妳看還有什麽問題沒有,請留言。

  • 上一篇:原始殺戮的遊戲細節
  • 下一篇:雨刮噴水怎麽開啟,雨刮器怎麽噴水
  • copyright 2024編程學習大全網