+92 332 4229 857 99ProjectIdeas@Gmail.com

String StartsWith And EndsWith Functions (C#.net)




See the example below how StartsWith() and EndsWith() funtions.






 For example (StartsWith()):
  
  string strOne = "rocks Rum";
  bool result = strOne.StartsWith("R",StringComparison.CurrentCultureIgnoreCase);
  MessageBox.Show(result.ToString());

Output:
            True (Because string starts with ‘r’ ignoring case)

For example (EndsWith()):

  string strOne = "rocks Rum"
  bool result = strOne.EndsWith("m", StringComparison.CurrentCultureIgnoreCase);
  MessageBox.Show(result.ToString());

Output:
            True (Because string ends with ‘m’ ignoring case)

0 comments: