Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Pisa(inputstr As String) As String
- Dim i As Long
- Dim temp As String
- If inputstr = vbNullString Then
- splitbycaps = temp
- Exit Function
- Else
- temp = inputstr
- For i = 1 To Len(temp)
- If Mid(temp, i, 1) = UCase(Mid(temp, i, 1)) Then
- If i <> 1 Then
- temp = Left(temp, i - 1) + " " + Right(temp, Len(temp) - i + 1)
- i = i + 1
- End If
- End If
- Next i
- Pisa = temp
- End If
- End Function
- 'regex
- Dim xSplit, i As Integer, Besar As Boolean
- Dim sTemp As String
- Dim Rng As Range, xData As Range
- Dim objRegex As Object
- Set objRegex = CreateObject("vbscript.regexp")
- Set Rng = Sheets(1).Range("A2:A5")
- For Each xData In Rng
- With objRegex
- .Global = True
- .Pattern = "([a-z])([A-Z])"
- xSplit = Split(.Replace(xData, "$1 $2"), " ")
- For i = 0 To UBound(xSplit)
- xData.Offset(0, i + 1).Value = xSplit(i)
- Next i
- End With
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement