by Oleg (2 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 5th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This small function will remove inner and outer spaces source string. works very fast.
Dim i_len As Integer
Dim i As Integer
Dim k As Integer
Dim s_temp_1 As String
Dim s_temp_2 As String
s_source_string = Trim(s_source_string) '// remove most right and most left empty string
i_len = Len(s_source_string)
k = 2 '// we start with second letter
For i = k To i_len
s_temp_1 = Trim(Mid(s_source_string, i, 1)) '// second charachter
s_temp_2 = Trim(Mid(s_source_string, (i + 1), 1)) '//third charachter
If Len(s_temp_1) = 0 And Len(s_temp_2) = 0 Then '// both are empty spaces
s_source_string = left(s_source_string, i) & Trim(Mid(s_source_string, i + 2))
i_len = Len(s_source_string)
k = i
End If
Next i
RemoveInnerSpace = s_source_string
End Function
No comments have been posted about This small function will remove inner and outer spaces source string. works very fast.. Why not be the first to post a comment about This small function will remove inner and outer spaces source string. works very fast..