Re: Special Character's in a string Compare

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Steve,

Thanks, however the results are the same. The syntax of the Case
statement and the If statement are the same. In your example the only way
the string with the (1) is shown is in the Case Else statement.
Unfortunately there are other possibilities that I must exclude, that is why
I am looking for onf those two exact strings. Any other ideas?




"Steven Burn" <somewhere@xxxxxxxxxxxxxxx> wrote in message
news:e2qAslbQFHA.2348@xxxxxxxxxxxxxxxxxxxxxxx
Watch for line wrap (each Case .. statement should be on one line)

Select Case lcase(strVal)
Case "server.test.com": Wscript.Echo "Value Name: " & arrValueNames(x)&"
= " & strVal
Case "server.test.com(1)": Wscript.Echo "Value Name: " &
arrValueNames(x)&" = " & strVal
Case Else: Wscript.Echo "Value Name: " & arrValueNames(x)&" = " & strVal
End Select

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Yogi_Bear_79" <IThankU@xxxxxxxxxxxx> wrote in message
news:v8OdnaVImeunKMLfRVn-3Q@xxxxxxxxxxxxxx
> The below code compares a variable read from a registry string value. It
> works fine except on the ElseIf Stastement. I believe it is because my
> string I am using to compare with has parenthesis in it. I know that
there
> is an occurance of this string with parenthesis in it. So my question is,
> how can I write the code to accept them literally or, is there a way to
> reduce this to a single IF statement and use a wildcard?
>
> If strVal = "server.test.com" Then
> Wscript.Echo "Value Name: " & arrValueNames(x)&" = " & strVal
> ElseIf strVal = "server.test.com(1)" Then
> Wscript.Echo "Value Name: " & arrValueNames(x)&" = " & strVal
> End If
>
>


.



Relevant Pages

  • Re: Reg Ex Challenge
    ... 'Finds an opening string, then searches for a closing string. ... Dim aRange As Word.Range ... ask if you want to extend to another closing parenthesis. ...
    (microsoft.public.word.vba.general)
  • Re: How to convert Infix notation to postfix notation
    ... I will assume that that string is not the ONLY string you have to ... In turn an additionFactor can be just a ... parenthesis, but the one that actually balances the left parenthesis. ... return expression(strInstring, ref intIndex1, ref strPolish);} ...
    (comp.lang.c)
  • Re: Formula for extracting text formated numbers within ( )s as numbe
    ... To extract and return the number within the parenthesis which is a ?number ... My String (XYZ) where XYZ is of variable length. ... The parenthesis is always at the right terminal end of the string. ...
    (microsoft.public.excel.misc)
  • Re: Reg Ex Challenge
    ... Public Sub NestedMatchingStringPairs(strOpeningString As String, ... then searches for a closing string. ... Dim aRange As Word.Range ... ask if you want to extend to another closing parenthesis. ...
    (microsoft.public.word.vba.general)
  • Re: Special Characters in a string Compare
    ... Ur I.T. Mate Group ... > The below code compares a variable read from a registry string value. ... > string I am using to compare with has parenthesis in it. ...
    (microsoft.public.scripting.vbscript)