indexOf 與 contains 的筆記

  • 1211
  • 0

摘要:indexOf 與 contains 的筆記

var str="Hello world, welcome to the universe.";
var n=str.indexOf("welcome");

可用此方法去解決文字中包含有特殊符號~!!!  OF javasprict

 

 

            string str = null;
            str = "CSharp TOP 10 BOOKS";
            if (str.Contains("TOP") == true)
            {
                MessageBox.Show("The string Contains() 'TOP' ");
            }
            else
            {
                MessageBox.Show("The String does not Contains() 'TOP'");
            } 

此為C# contains 的方法  以解決 文字中包含何種東西~!!!