Write a C# Sharp program to determine whether the string "birds" is a substring of a familiar
- برمجة سي شارب
- برمجة
- 2021-05-30
- ahmadghneem
الأجوبة
using System;
class Example38
{
public static void Main()
{
string str1 = "Kill two birds with one stone";
string str2 = "birds";
bool x = str1.Contains(str2);
Console.WriteLine("'{0}' is in the string '{1}': {2}",
str2, str1, x);
if (x) {
int index = str1.IndexOf(str2);
if (index >= 0)
Console.WriteLine("'{0} begins at character position {1}",
str2, index + 1);
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
