Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string s, x, a, b;
- Console.Write("Enter s string: ");
- s = Console.ReadLine();
- Console.Write("Enter s string: ");
- x = Console.ReadLine();
- Console.Write("Enter a string: ");
- a = Console.ReadLine();
- Console.Write("Enter b string: ");
- b = Console.ReadLine();
- Console.WriteLine();
- Console.WriteLine(chekIfX_ExistInS(s, x, a, b));
- }
- private static string chekIfX_ExistInS(string str, string searchedStr, string a, string b)
- {
- if (str.Contains(searchedStr) && str.Contains(a) && str.Contains(b))
- {
- return "Substring \"" + searchedStr + "\" exist in string \"" + str + "\" with start index " +
- str.IndexOf(searchedStr) + ".";
- }
- return "Substring \"" + searchedStr + "\" does not exist in string \"" + str + "\"";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement