title: Trim function does not remove spaces at end of a string while comparing two strings in vbs
body: <p>I have a simple script which takes two strings and compare them. The first one has a space at the end and the second does not have that.</p>
  
  <pre><code>Function compare(str1,str2)
   dim a 
   If strComp(trim(str1),trim(str2))=0 Then 
       msgbox "OK"
       a=1  
   Else
       msgbox "KO" 
       a=0
   End If    
  
   compare=a
  
  End Function
  </code></pre>
  
  <p>I use this function in this way:</p>
  
  <pre><code>s1=     SUCCESSFULLY CONNECTED
  s2=     SUCCESSFULLY CONNECTED
  result=compare(s1,s2)
  </code></pre>
  
  <p>The difference between s1 and s2 is that s1 ends with a single space while s2 does not have any space at the end. This why I use the Trim function to ignore that space. 
  Despite that, for s1 and s2, I always get the message "KO" in dialog box. I have even changed the condition by </p>
  
  <pre><code>If trim(str1)=trim(str2) Then
  </code></pre>
  
  <p>But popup is still returned "KO". This is a wonderful situation!</p>
  
  <p>Please, I'm tired of that and hope that you help understand this situation.
  Thank you in advance </p>