Strange Issue with String.IndexOf()

I am using

Function(String b)//where b="FunGroup"

{

String Categories= Contact.Categories // Categories return "FunGroup"

Categories.IndexOf(b) // returns -1 .. where as it shall return 0

}

What can be the issue




Answer this question

Strange Issue with String.IndexOf()

  • ClaudeG

    Airan wrote:

    Found the answer,

    i was reading categories from Contacts and it returns categories with a space before the category name ..Culprit found and fixed too :)


    good to hear ... if you wouldn't mind though, mark mine as answer, since I did bring up checking for spaces ... would appreciate the credit.


  • cookieCutter

    sry, edited, misread, and the stupid forum software won't let me edit ..

     

    you're certain the returned, searched value is what you expect no spaces, non-visible characters, etc. ASCII, and not unicode, or vice versa


  • kostrin

    Found the answer,

    i was reading categories from Contacts and it returns categories with a space before the category name ..Culprit found and fixed too :)




  • Strange Issue with String.IndexOf()