Answers for "stringbuilder contains c#"

C#
0

stringbuilder contains c#

StringBuilder stringb = new StringBuilder();
stringb.Append("Snowy Owl.");
stringb.AppendLine();

stringb.Append("Tawny Owl.");
stringb.AppendLine();

stringb.Append("Jamaican Owl.");
stringb.AppendLine();

//this line find substring in stringbuilder.
bool result = stringb.ToString().Contains("Cave Swiftlet");

//this is a technique to find substring in stringbuilder.
bool result2 = stringb.ToString().Contains("Tawny Owl");

Console.WriteLine(stringb.ToString());
Console.WriteLine("stringbuilder contains('Cave Swiftlet'): " + result.ToString());
Console.WriteLine("stringbuilder contains('Tawny Owl'): " + result2.ToString());
Posted by: Guest on July-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language