1 Attachment(s)
VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Hai all..:)
You all will be having problem while copying VBCodes from this forum(i.e. VBForums.com).
I had created this program to remove those numbers present in the VBCode, when you copy it from a thread or a post..:)
I think this will be helpful in some way to the users of VBForums.com...
Kindly post your suggestions and comments...:D
I wish to thank my parents and my brother for all their help and encouragement...:)
-Regards,
Akhilesh B Chandran
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Heres what I came up with, (with some optimizing help from anhn).
This is mainly usefull for users of FireFox when copying posted source code in VBForums.
Code:
' Code Cleaner v1.2 - Ed Wilk / Edgemeal May 29th, 2008
'
' Removes prefixed spaces if all lines
' have at least one prefixed space character.
' Removes those unwanted lines with numbers and # characters.
Public Function CodeCleaner(sText As String) As String
Dim s() As String
Dim l As Long, EmptySpace As Long
Dim RemovedItem As Boolean
' put text into array, seperated by carraige returns.
s = Split(sText, vbCrLf)
' remove empty array items and items that start with a number or a "#" character.
Do
RemovedItem = False
For l = 0 To UBound(s)
If Len(s(l)) = 0 Or IsNumeric(s(l)) Or (s(l)) = "#" Then
RemoveArrayItem s, l
RemovedItem = True
Exit For
End If
Next l
If RemovedItem = False Then Exit Do
Loop
' remove excess prefix space characters.
Do
For l = 0 To UBound(s)
If Mid$(s(l), 1, 1) <> " " Then Exit Do
Next l
For l = 0 To UBound(s)
s(l) = Mid$(s(l), 2)
Next l
Loop ' check for more prefixed spaces.
' Re-Join array items & return.
CodeCleaner = Join(s, vbCrLf)
End Function
Private Sub RemoveArrayItem(ByRef Arry As Variant, ByVal Lindex As Long)
Dim k As Long
If Lindex < UBound(Arry) Then
For k = Lindex To UBound(Arry) - 1
Arry(k) = Arry(k + 1)
Next k
End If
ReDim Preserve Arry(UBound(Arry) - 1)
End Sub
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Thanks for sharing it....:)
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Here is a bookmarklet for Firefox that you might find useful/interesting. For easy use make sure you have a bookmark toolbar visible (View > Toolbars), then add a new bookmark to there by right clicking it > New bookmark... and title it as VBcode and make it's url the following:
Code:
javascript:var%20s=new%20Array();s=document.getSelection().split("#\r\n");var%20j=s.join('');document.innerHTML+='<textarea%20id="a"%20style="position:fixed;left:0;top:0;width:100%;height:100%"%20onmouseover="this.select()"%20onkeypress="history.go(-1)">'+j+'</textarea>'
Now when you select code (or anything else on the page) and click that button, you will get a textbox that gets selected as you move your mouse a little, and you can push Ctrl + C to copy and get back to where you were.
I had to do it like this because by default you can't use JavaScript in Firefox to copy stuff into the clipboard due to security issues it arises when it is enabled.
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Thanks Merri:)
thankr for sharing it
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Quote:
Originally Posted by Merri
Here is a bookmarklet for Firefox
Hmmmm all I get back is one long continuous line of code.:confused:
Re: VB6-Code Cleaner v1.0: software to remove numbers when U copy VBCodes from this forum
Don't use it on regular code blocks, use it on the highlighted ones. Regular code blocks you can just select with your mouse and Ctrl + C, no point going through a button.