0

I am using cosmos to practice my c# and better my understanding of OS. I am trying to use a IndexOf method but VMware gives me:

Be aware: IndexOf(..., Stringcomparison) not fully supported yet!

Are there any alternative for Indexof method? For example, if my string is "hello@world" i'd like to find that the index of @ is 5.

m.k
  • 73
  • 1
  • 10
  • You should search the documentation and try to understand if these part not supported are of any relevance to your code – Steve Oct 26 '16 at 15:10
  • I googled it, but I could not find anything regarding this. – m.k Oct 26 '16 at 15:12
  • 2
    Going directly to the source is a way: http://cosmos.codeplex.com/discussions/536735 – Steve Oct 26 '16 at 15:15
  • I do not still understand.. I made sure types are matched. String find = "@", word = "hello@world" and I did int index = word.IndexOf(find). But I am still getting the same error. Please help – m.k Oct 26 '16 at 15:29
  • @m.k the point is that this is not full C# on Cosmos, but a subset of it that is not fully implemented yet. – crashmstr Oct 26 '16 at 16:04

1 Answers1

0

You can always implement a similar method yourself. Such a bare-bone method that returns the index of a char or -1 if wasn't found can be:

public int FindIndexOfChar(string str, char c)
{
    for (int i=0;i<str.length;i++)
        if (str[i]==c)
            return i;
    return -1;
}

It really depends upon the functionality you want.

SteelSoul
  • 131
  • 2
  • 9