要store character應該點做? [緊急]!!

2008-01-09 3:39 am
visual basic問題

我想一個一個字母咁store,
但用string就成個word咁read
唔可以逐個字母read.

我想問應該點做?

有冇得dim variable as char

定dim佢做咩黎store char

回答 (2)

2008-01-09 10:45 pm
✔ 最佳答案
系唔系甘樣:
Dim strTest As String
Dim i As Integer
Dim strStored As String
strTest = "Hello,World"
MsgBox "String length=" & Len(strTest), vbInformation, strTest
For i = 1 To Len(strTest)
Store = MsgBox("The " & i & StNdRdTh(i) & " character is " & Mid$(strTest, i, 1) & vbCrLf & "Store it?", vbYesNo, "Store Value")
If Store = vbYes Then
strStored = strStored & Mid$(strTest, i, 1)
End If
Next
MsgBox Len(strStored) & "word(s) stored :" & vbCrLf & strStored
'自己寫左個Function轉th、st果D
Function StNdRdTh(n As Integer) As String
If n = 11 Or n = 12 Or n = 13 Then
StNdRdTh = "th"
Exit Function
Else
Select Case Right$(CStr(n), 1)
Case 1
StNdRdTh = "st"
Case 2
StNdRdTh = "nd"
Case 3
StNdRdTh = "rd"
Case Else
StNdRdTh = "th"
End Select
End If
End Function
2008-01-09 4:40 pm
有好多方法, 請問你有用 substr() 嗎?


收錄日期: 2021-04-27 13:56:30
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080108000051KK03200

檢視 Wayback Machine 備份