using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
Console.Write("filename = ");
string filename = Console.ReadLine();
if (File.Exists(filename))
{
FileStream fp = new FileStream(filename, FileMode.Open);
StreamReader reader = new StreamReader(fp);
Console.WriteLine("masukan kata yg ingin diganti :");
string n = (Console.ReadLine());
Console.WriteLine("masukan kata yg ingin menggantikan :");
string m = (Console.ReadLine());
Console.WriteLine(reader.ReadToEnd().Replace(n,m));
reader.Close();
fp.Close();
}
else
Console.WriteLine("file is not found!");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
Console.Write("filename = ");
string filename = Console.ReadLine();
if (File.Exists(filename))
{
FileStream fp = new FileStream(filename, FileMode.Open);
StreamReader reader = new StreamReader(fp);
Console.WriteLine("masukan kata yg ingin diganti :");
string n = (Console.ReadLine());
Console.WriteLine("masukan kata yg ingin menggantikan :");
string m = (Console.ReadLine());
Console.WriteLine(reader.ReadToEnd().Replace(n,m));
reader.Close();
fp.Close();
}
else
Console.WriteLine("file is not found!");
}
}
}
No comments:
Post a Comment