locked
case sensitive question RRS feed

  • Question

  • User968218215 posted

     

    hi,

    i have the below code where if 's' is 'TESTER\Internet'...it will return true.  However if i write...If (s = "tester\internet")....it will not return true. 

    i need it to work regardless of the case but i can not get it...what am i doin wrong.

    thanks...

    ------------------------------------------------

     For Each s In al

      '''''CASE SENSITIVE
     If (s = "TESTER\Internet") Then

                    Return "YES"

                End If
     Next

    Thursday, June 11, 2009 1:23 PM

Answers

  • User968218215 posted

     

    the below worked exactly as needed...thanks... 

     

    s.Equals("TESTER\Internet", StringComparison.CurrentCultureIgnoreCase)

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 12, 2009 4:55 AM

All replies

  • User1485238302 posted

    You could also do something like 

    string.Equals(s, "TESTER\Internet", StringComparison.CurrentCultureIgnoreCase) 
    or 
    s.Equals("TESTER\Internet", StringComparison.CurrentCultureIgnoreCase)
    
    
     
    Thursday, June 11, 2009 3:57 PM
  • User968218215 posted

     

    the below worked exactly as needed...thanks... 

     

    s.Equals("TESTER\Internet", StringComparison.CurrentCultureIgnoreCase)

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 12, 2009 4:55 AM