Library code snippets
Strip Spaces from String
By Andrew Yap, published on 14 Jul 2001
Strip Spaces from String
Usually this function helps a lot in data cleansing.
Call the function FnCleanString with a string values and it will reformat and pass back a string with all the spaces removed.
You can modify this code to cater for other scenarios, say stripping numeric characters or stripping non alphabets from string.
Usefulness is very much on how creative you can apply this function. Have fun.
:)
Function FnCleanString(pString As String) As String
Dim tString As String
Dim tLength As Integer
Dim lCtr As Integer
tString = ""
tLength = Len(pString)
For lCtr = 1 To tLength
If Mid(pString, lCtr, 1) <> " " Then
tString = tString & Mid(pString, lCtr, 1)
End If
Next lCtr
FnCleanString = tString
End Function
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Comments
Leave a comment
Sign in or Join us (it's free).