static void Main(string[] args)
{
if (args.Length <2 )
{
Console.WriteLine("Add text to front and back, AFrontBacktxt inputFile <front> <back> > output");
Console.WriteLine("use null for not have data");
return;
}
string filename = args[0];
string frontCmd = args[1];
string backCmd = "null";
if (args.Length > 2)
{
backCmd = args[2];
}
StreamReader sr = new StreamReader(filename);
string data = sr.ReadToEnd();
sr.Close();
string[] dataline = data.Split('\n');
foreach (string s in dataline)
{
if (s.Length == 0 || s.Trim()=="") continue;
string s_R= s.Replace("\r","").Replace("\"","").Trim();
string outS= s_R;
if(frontCmd!="null"){
outS= frontCmd.Replace("\"","")+" "+outS;
}
if(backCmd!="null"){
outS= outS+" "+backCmd.Replace("\"","");
}
Console.WriteLine(outS);
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น