Skip to content

Instantly share code, notes, and snippets.

@tasugim
Last active January 3, 2016 14:08
Show Gist options
  • Select an option

  • Save tasugim/f0f6d42ecd5597e6e502 to your computer and use it in GitHub Desktop.

Select an option

Save tasugim/f0f6d42ecd5597e6e502 to your computer and use it in GitHub Desktop.
文字列を文字の配列に分割するVBAのカスタムファンクション
' 文字列を文字の配列に分割する
Private Function SplitStringToArrayOfChar(str As String) As String()
Dim buff() As String
Dim i As Integer
ReDim buff(Len(str) - 1)
For i = 1 To Len(str)
buff(i - 1) = Mid$(str, i, 1)
Next i
SplitStringToArrayOfChar = buff
End Function
' 文字列をCharの配列に分割する(ASCII文字列限定版)
Private Function SplitStringToArrayOfCharForAscii(str As String) As String()
SplitStringToArrayOfCharForAscii = Split(StrConv(str, vbUnicode), Chr$(0))
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment