17-03-20, 08:19 AM
كود :
private static void Main(string[] args)
{
try
{
string str = File.ReadAllText("filename.txt").Trim();
string path = "large.txt";
string format = str + "{0}.txt";
int num = Convert.ToInt32(File.ReadAllText("perfile.txt"));
using (StreamReader streamReader = new StreamReader(path))
{
int num2 = 0;
StreamWriter streamWriter = new StreamWriter(string.Format(format, num2 + 1));
try
{
int num3 = 0;
string value;
while ((value = streamReader.ReadLine()) != null)
{
if (num3 >= num)
{
num3 = 0;
num2++;
streamWriter.Dispose();
streamWriter = new StreamWriter(string.Format(format, num2 + 1));
}
streamWriter.WriteLine(value);
num3++;
}
}
finally
{
streamWriter.Dispose();
}
}
}
catch (Exception var_9_E2)
{
}
}
}
}اانا اريد اخر السطر فقط ااذا كان يوجد مسافه يحذفها


