<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:s="http://www.techrepublic.com/search" xmlns:dc="http://purl.org/dc/elements/1.1/"  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
    <title><![CDATA[Discussion on Normalizing spaces in VB6 strings ]]></title>
    <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832]]></link>
    <atom:link rel="hub" type="application/rss+xml" href="http://pubsubhubbub.appspot.com/" />
    <atom:link rel="self" type="application/rss+xml" href="http://www.techrepublic.com/forum/discussions/87-182832/rss" />

    <description><![CDATA[]]></description>
    <language>en-us</language>
    <lastBuildDate>2013-05-21T13:33:26-07:00</lastBuildDate>
             

    <item>
        <title><![CDATA[FYI]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1886685]]></link>
        <description><![CDATA[Just FYI, I tried programming three different methods and timed each of them.Method 1:  Replace 2 spaces by 1 until no more double-spaces.Method 2:  Scan string and move each character downwards except if there are multiple spaces.Method 3:  Replace 2^x+1 spaces with 1 space, decreasing x until you're done.Results varied widely between the three methods, each having cases where it did better or worse than the others.Method 1 did best overall, with its strength being for long strings with short lengths of white space in them.Method 2 did best on shorter strings.Method 3 vastly outperformed the others on longer strings that were nearly all spaces.Rob]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1886685]]></guid>
        <dc:creator><![CDATA[RobinHood70]]></dc:creator>
        <pubDate>Thu, 17 Nov 2005 12:06:13 -0800</pubDate>
    </item>
             

    <item>
        <title><![CDATA[This might work, but...]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1886628]]></link>
        <description><![CDATA[In Pascal, this (or the variation posted later) would probably work moderately well.  However, in VB, this type of string manipulation isn't quite as efficient, since VB allocates memory for strings very badly.  Even using the Mid statement (not the function, the statement), something most VB programmers are less than fully familiar with, you will likely be allocating memory for string comparisons and the like, wasting FAR more time than you would actually save.Your approach, while better in C/Pascal/Assembly, though it could be improved by manipulating the input string directly, would probably be less workable and less efficient in VB.If you REALLY want to prove your point to everybody who has flamed you in this thread, write the procedure in VB, and give us time comparisons of a looped replace vs. your method.Rob]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1886628]]></guid>
        <dc:creator><![CDATA[RobinHood70]]></dc:creator>
        <pubDate>Thu, 17 Nov 2005 10:54:11 -0800</pubDate>
    </item>
             

    <item>
        <title><![CDATA[this OR that OR there]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1874796]]></link>
        <description><![CDATA[You can't win a prize by giving all the possible answers.  just one.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1874796]]></guid>
        <dc:creator><![CDATA[techrepublic@...]]></dc:creator>
        <pubDate>Tue, 01 Nov 2005 05:24:47 -0800</pubDate>
    </item>
             

    <item>
        <title><![CDATA[errr . . . umm . . .]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1872060]]></link>
        <description><![CDATA[Fuggeddaboudit . . . I misread the article =]I read it as removing all spaces . . .]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1872060]]></guid>
        <dc:creator><![CDATA[~Neil]]></dc:creator>
        <pubDate>Thu, 27 Oct 2005 06:51:55 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[This is simpler]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1872033]]></link>
        <description><![CDATA[If you're pulling all of the spaces out;NewString = Join(Split(OldString, &quot; &quot;), &quot;&quot;)You could do this to replace multiple spaces with single spaces, too, but it would then replace 3 or four spaces with two; so you would need to put it into a while loop.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1872033]]></guid>
        <dc:creator><![CDATA[~Neil]]></dc:creator>
        <pubDate>Thu, 27 Oct 2005 06:36:16 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Help me out...]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867646]]></link>
        <description><![CDATA[by letting this thing end. Your other post is just hanging there so big and juicy. If you don't reply, I'll back off, otherwise I'll hang on a comment you won't like. So you better be ready to bring it.Maybe you're young or something, because this is too much like shooting fish in a barrel. I don't want to beat up a kid even if he is obnoxious.I'm actually gonna stop trying to respond when other people get flamed unjustly, because it just opens up a Pandora's box of people who don't care about fairness and just want to try and embarass anybody they can. I try to just go after people who deserve it, like you.Do you actually know what 'gullible' means?http://dictionary.reference.com/search?q=gullibleI'm kinda sorry you had to take the heat on this. I like to get along, but when I'm attacked there is no length I won't go to verbally, in an Oscar Wilde kind of way, to crush my attacker.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867646]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Wed, 19 Oct 2005 13:07:33 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Now I get it, maybe]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867634]]></link>
        <description><![CDATA[I misread your message because we were talking about getting rid of double-spaces and you're talking about escaping single-quotes (?). I guess your code was a joke because nothing changed.If you're flaming me for testing his assertion, you can bite me. Up until .NET, I primarily coded in C++. Now that trim is available in both languages, I use it all the time, but I doubt I ever checked to see that it left embedded spaces alone. Since I was gonna flame a guy, I made sure I knew what I was talking about, despite the documentation.If you seriously think that line of SQL is gonna work, then I don't have to test a damn thing to pronounce you full of s**t.You either need help with your coding or your comedy act.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867634]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Wed, 19 Oct 2005 12:29:21 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Is This It?]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867485]]></link>
        <description><![CDATA[I guess I am gullible, because I can't figure out what your example means. Are you trying to say the spaces don't need to be normalized in SQL? I think we all know that, except for TechRepublic@.Otherwise I'm really missing your point. All of this is pretty much fit for a beginning VB class, I just couldn't resist blasting someone who posts crappy pascal and then tells someone else that the thread is over their head because they won't go to the trouble of deciphering his crappy code.How did I gore your ox?]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867485]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Wed, 19 Oct 2005 09:33:58 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Reason At Last]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867437]]></link>
        <description><![CDATA[Exactly. I gotta get away from this thread, but TechRepublic@ was just too juicy of a target, and now I've got slackola as well.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867437]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Wed, 19 Oct 2005 09:12:36 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Bad sql]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867436]]></link>
        <description><![CDATA[I'm not interested enough to figure out what you're trying to say, but I'm afraid that sinqle quote in 'cscoder's gullible' is going to give you problems.Are you sure you're not @TechRepublic in disquise, there are marked similarities.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1867436]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Wed, 19 Oct 2005 09:08:33 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Suspect the code that implements]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866200]]></link>
        <description><![CDATA[the regular expression might have a loop in it somewhere.Only a guess but I feel it's unlikely that VB is optimising the while statement to it best possible potential, simply because you could do that as double space could be held as a word or an integer depending on what size of character was being processed. I can't think of any reason at all why any compiler would go to this length for optimising searching on 1 -2 or 1-4  character strings. Equally, except in extremely extreme circumstances I fail to see the value of optimising in terms of the effort required vs the reward gained. Two days work for thirty clock cycles just doesn't fire me up and might get me fired.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866200]]></guid>
        <dc:creator><![CDATA[Tony Hopkinson]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 16:08:57 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Regular Expressions are available, why not use them?]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866193]]></link>
        <description><![CDATA[I have been referencing the regular expression library in my projects for years...you could have a regular expression do all that work without a loop at all...]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866193]]></guid>
        <dc:creator><![CDATA[ferdfrog@...]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 15:10:58 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[use of String(2,&quot; &quot;)]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866022]]></link>
        <description><![CDATA[The author probably used String(2,&quot; &quot;) because code with double spaces might not display nicely in a browser as strait text.  An even more useful function might be  0    s = Replace(s, DupLiteral, DupTypeToRemove)LoopRemoveDupChars = sEnd Function]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866022]]></guid>
        <dc:creator><![CDATA[slackola]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 11:56:18 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Trim is like magic]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866020]]></link>
        <description><![CDATA[I also needed all of my embedded single qoutes to be escaped in my sql statement, so I just run it through Trim as well, and viola!Trim(&quot;Select name from Emp where skill = 'cscoder's gullible'&quot;)returnsSelect name from Emp where skill = 'cscoder's gullible']]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1866020]]></guid>
        <dc:creator><![CDATA[slackola]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 11:46:19 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Hmmmm...Are You Tripping?]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865932]]></link>
        <description><![CDATA[I actually tested your claim because it was so outrageous I had to make sure I wasn't tripping. That was 10 wasted minutes I'll never get back. Probably a lot less embarassing for you if you tested before posting as well.Here's what MS says it does.... Visual Basic 6.0 &gt;  Reference &gt;   Visual Basic for Applications ReferenceLTrim, RTrim, and Trim Functions...Returns a Variant (String) containing a copy of a specified string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865932]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 09:33:10 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Normalizing spaces in VB6 strings, hmmmm]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865900]]></link>
        <description><![CDATA[Why not use the Trim() key word, then every body knows what going on, i.e . removes leading and trailing spaces, and those unwanted double spaces as well.Paul]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865900]]></guid>
        <dc:creator><![CDATA[PaulR I]]></dc:creator>
        <pubDate>Mon, 17 Oct 2005 09:08:07 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Swell.]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865162]]></link>
        <description><![CDATA[So, it took you 12 (and later 19) lines of code (once you remove the Function/Procedure definition statements) to accomplish(?) the same thing that Peter did in 5.  2.4 to 3.8 times as large.  Brilliant.After you thought about it for a while (billing your client for your time I suppose), in your second example (&quot;2nd thoughts&quot;) you modified your flawed routine to walk the string backwards to correct its inability to handle strings containing leading or 3 or more consecutive spaces, but in the process you included 2 WHILE loops, the very thing you ragged at Peter about.  Also, both of your solutions require defining an output string (&quot;b&quot;) while Peter's modifies the original in place.  Strange for someone so &quot;storage conscious&quot;.An earlier TechRepublic article this week pointed out that upwards of 70% of IT's budget can be spent on maintenance.  I would MUCH rather work with Peter's code than with your indecipherable crap.You volunteered that you &quot;haven't coded much in years&quot;.  Whatever it is you've been doing since you stopped coding, maybe you should consider going back to it because the Professional programming world has left you behind.  And as one of your coding examples appropriately pointed out: You Suck !]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1865162]]></guid>
        <dc:creator><![CDATA[Hubert1497@...]]></dc:creator>
        <pubDate>Sat, 15 Oct 2005 04:14:23 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Not elegant enough for me]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864989]]></link>
        <description><![CDATA[How about a recursive version ?Procedure NormaliseString(Var Str : String);Begin  While Pos('  ',Str) &gt; 0 Do    Str := NormaliseString(Delete(Str,Pos('  ',Str),1));End;Tee HeeCome on you all did the Towers of Hanoi example you can figure it out, even if you've never used it since.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864989]]></guid>
        <dc:creator><![CDATA[Tony Hopkinson]]></dc:creator>
        <pubDate>Fri, 14 Oct 2005 16:10:11 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Too good to pass up]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864984]]></link>
        <description><![CDATA[I know I said I'd stop, but I just realized you, of all people, told someone else that this thread is over their head. This is some kind of elaborate joke, right?]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864984]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Fri, 14 Oct 2005 15:05:25 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Why I Oughta...]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864956]]></link>
        <description><![CDATA[Hey, wait just a dag-nabbed minute. I just realized, I'm a coder.That's all I've done for 24 years, no management, no project lead, just because I like programming so much.And mostly I code in c#, and the extension for c# files is .cs, so since I really am a coder and I code in c#, maybe I'm not a 'kinds like people' after all. Whadda ya think?]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/discussions/87-182832-1864956]]></guid>
        <dc:creator><![CDATA[innocent_bystander]]></dc:creator>
        <pubDate>Fri, 14 Oct 2005 14:52:30 -0700</pubDate>
    </item>
    </channel>
</rss>

