2
Reply

Use String.StartsWith(value) with incomplete value string

Milan Spinka

Milan Spinka

Aug 6 2015 12:45 PM
400
Hi all,
 
I would like to know how to use the bool String.StartsWith(string value) like this:
       
void Main()
{ 
      int random; //this is an int that will change randomly
      string _uStr = "The random int is currently " + random.ToString() + " and this is another text";
      
      if (_uStr.StartsWith ("The random int is currently something and this"))
      {
            //execute something
      } 
}
 
My question: Is there a way of replacing something to ignore several characters in the string?  

Answers (2)