'配列取り出し
Function GetItemByIndex(inputStr As String, index As Integer) As String
Dim items() As String
items = Split(inputStr, ",")
If index >= 1 And index <= UBound(items) + 1 Then
GetItemByIndex = items(index - 1)
Else
GetItemByIndex = ""
End If
End Function
'配列重複削除
Function RemoveDuplicatesCSV(inputStr As String) As String
Dim items() As String
Dim dict As Object
Dim i As Integer
Dim result As String
Set dict = CreateObject("Scripting.Dictionary")
items = Split(inputStr, ",")
For i = LBound(items) To UBound(items)
If Not dict.exists(Trim(items(i))) Then
dict.Add Trim(items(i)), True
End If
Next i
RemoveDuplicatesCSV = Join(dict.keys, ",")
End Function
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme