using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("masukan kata : ");
string s = (Console.ReadLine());
Console.WriteLine("masukan kata yg ingin dihapus :");
string n = (Console.ReadLine());
string[] kata = s.Split(' ');
for (int i = 0; i <= kata.Length - 1; i++)
{
int e=(kata[i].IndexOf(n));
if (e>=0)
{
kata[i] = kata[i].Remove(0, n.Length);
Console.Write(" {0}", kata[i]);
}
else
{
Console.Write(" {0}", kata[i]);
}
}
Console.WriteLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("masukan kata : ");
string s = (Console.ReadLine());
Console.WriteLine("masukan kata yg ingin dihapus :");
string n = (Console.ReadLine());
string[] kata = s.Split(' ');
for (int i = 0; i <= kata.Length - 1; i++)
{
int e=(kata[i].IndexOf(n));
if (e>=0)
{
kata[i] = kata[i].Remove(0, n.Length);
Console.Write(" {0}", kata[i]);
}
else
{
Console.Write(" {0}", kata[i]);
}
}
Console.WriteLine();
}
}
}
No comments:
Post a Comment