Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Working on an ASP
Message
From
12/11/1999 08:05:43
 
 
To
11/11/1999 21:18:15
General information
Forum:
Visual Basic
Category:
VBScript
Miscellaneous
Thread ID:
00290441
Message ID:
00290521
Views:
24
>How can I grab a form value, that might look like "John A. Doe" and make it into "JohnADoe", in other words, strip the period and spaces.
>
>I think this belong in VBScript category, thats what code in an ASP is, right? VBScript?

Hey Mike,

The following does what you want:
Call it like this StripEm("John A. Doe")
and it returns "JohnADoe"
' This function will remove any non A-Z or a-z values (Case is NOT changed)
Public Function StripEm(str2bStripped As String)
Dim strResult, strChar As String
Dim intCurChar As Integer

    For intCurChar = 1 To Len(str2bStripped) ' Define what is to be walked
        strChar = Mid(str2bStripped, intCurChar, 1) ' Walk the param
        
            ' Check to see if its a letter if so add it to the result
            If Asc(UCase(strChar)) >= 65 And Asc(UCase(strChar)) <= 90 Then
                strResult = strResult & strChar 'add to the result
            End If
            
    Next 'loop

StripEm = strResult 'Return our value
End Function
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Reply
Map
View

Click here to load this message in the networking platform