What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB/Web Help

VB/Web Help
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: VB/Web Help
this is totally as a sidenote:

Stigmata's extra encoding function is indeed what I meant with the extra checking/validating that needs to be done (although it misses many other special characters). Anyways, the Encode function as Stigmata posted it, can be made much more efficient and smaller ;)

1) to begin with loose the sAsc variable. Great for explanation, but it is only used once and directly in the IF THEN ELSE, so no need for that.
2) No need for getting the ascii value of the character and comparing it to 32, if you can directly compare the character itself to a space (although, this is some clock ticks slower, the code is much shorter)
3) No need to slowly build a new string again when you're only replacing individual characters. You can directly replace them in the original string.
4) Loose the ByVal. ByVal's are very slow compared to ByRef's (with a ByVal, VB needs to create another instance of the variable). To overcome writing over the original variable you can directly manipulate the function's output string.
5) Longs work faster than Integers (in this case) so declare I as a long...

So we get:
code:
Public Function Encode(s As String) As String
    Dim I As Long
    Encode = s
    For I = 1 To Len(Encode)
        If Mid$(Encode, I, 1) = " " Then
            Mid$(Encode, I, 1) = "+"
        End If
    Next I
End Function
But hey, isn't that simply replacing every space with a "+"? Well yes, so... simply use VB's Replace function:
[code]Replace(URLString, " ", "+")

PS: nevertheless, you must make an "Encode" routine anyways, to encode your text into the proper characters and "escape codes" (forgot the correct name for them) so you can use them in URLs...


:D ;)


EDIT: Mike, you're late :XP: hihi ;)

This post was edited on 10-04-2005 at 06:19 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-04-2005 04:26 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
VB/Web Help - by DragonX on 10-04-2005 at 07:11 AM
RE: VB/Web Help - by rav0 on 10-04-2005 at 09:44 AM
RE: VB/Web Help - by brian on 10-04-2005 at 10:22 AM
RE: VB/Web Help - by CookieRevised on 10-04-2005 at 03:52 PM
RE: VB/Web Help - by Stigmata on 10-04-2005 at 04:14 PM
RE: VB/Web Help - by CookieRevised on 10-04-2005 at 04:26 PM
RE: VB/Web Help - by Mike on 10-04-2005 at 04:29 PM
RE: RE: VB/Web Help - by CookieRevised on 10-04-2005 at 04:49 PM
RE: VB/Web Help - by DragonX on 10-04-2005 at 07:48 PM
RE: VB/Web Help - by DragonX on 10-04-2005 at 07:52 PM
RE: VB/Web Help - by Ezra on 10-05-2005 at 02:28 PM
RE: RE: VB/Web Help - by CookieRevised on 10-05-2005 at 03:33 PM
RE: VB/Web Help - by YottabyteWizard on 10-05-2005 at 04:15 PM
RE: VB/Web Help - by segosa on 10-05-2005 at 07:19 PM
RE: RE: VB/Web Help - by CookieRevised on 10-05-2005 at 09:48 PM
RE: VB/Web Help - by Ezra on 10-05-2005 at 07:23 PM
RE: VB/Web Help - by YottabyteWizard on 10-05-2005 at 08:08 PM
RE: VB/Web Help - by DragonX on 10-05-2005 at 09:00 PM
RE: VB/Web Help - by YottabyteWizard on 10-06-2005 at 04:44 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On