板 1- 前 次 新 レス
for REMA-PING
[13]kiyo:2003/10/31(Fri) 21:54
'結局書いた
Function supList(BODY)
s = "-"
'ハイフンで区切った整数値を補完して空白区切りリストで返す
BODY = s + Trim(BODY) + s
Dim ElList() As String
count = -1
' 一次ループ
For n = 0 To Len(BODY) - 1
If Mid(BODY, n + 1, 1) = s Then count = count + 1
Next
ReDim ElList(count)
' 二次ループ
c = 0
For n = 0 To Len(BODY) - 2
If Mid(BODY, n + 1, 1) = s Then
sTartX = n + 2
ength = InStr(sTartX, BODY, s) - sTartX
ElList(c) = Mid(BODY, sTartX, ength)
c = c + 1
If c >= count Then c = count - 1
End If
Next n
' 三次ループ
' 戻り値の初期化
supList = ElList(0)
For c = 0 To (count - 2)
If ElList(c) = ElList(c + 1) Then
'nop
Else
If ElList(c) > ElList(c + 1) Then
stp = -1
Else
stp = 1
End If
For a = Val(ElList(c)) + stp To Val(ElList(c + 1)) Step stp
supList = supList + Str(a)
Next
End If
Next c
supList = Trim(supList)
End Function
前 次 新