-1

hi i wants to create an dll file for removing blankspaces in a given string..........
here iam writing the code but it was not working.....
please give me the correct code....
here iam using asp.net with vb.net

Namespace fillblank
    Public Class Class1
        Private Sub blankspces()
            Dim a
            Dim done
            a = " "
            Do Until done
                If InStr(1, a, "  ") = 0 Then
                    done = True
                Else
                    a = a.Replace("  ", String.Empty)
                End If
            Loop
            'a.Trim.Replace(" ", String.Empty)
        End Sub
    End Class
End Namespace

please help me

Votes + Comments
Stop!
4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by crishjeny
0

The built-in feature of .NET String class has methods to remove spaces in a given string. Why do you want to go for a custom method?

String str1 = "This is a string"
String str2  = str1.Replace(" ", String.Empty)

Here str2 will have the string value "Thisisastring".

0

The built-in feature of .NET String class has methods to remove spaces in a given string. Why do you want to go for a custom method?

String str1 = "This is a string"
String str2  = str1.Replace(" ", String.Empty)

Here str2 will have the string value "Thisisastring".

hi here i have to remove so many blank spaces that occurs within string in more than 10 forms....so i want to create an dll file ,by calling tha dll file the blank spaces withinn a string to be removed in every form........
so please give me the code for removing blank spaces for creartion of a dll file..........

0

Hi

I had same problem.You can use following code.It will help you.

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = Trim(strLine) & vbCrLf
strText = strText & strLine
Loop

objFile.Close

Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForWriting)
objFile.Write strText
objFile.Close

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.