Hi am a string i want remove bracket how can achieve that
i want to like this Ship_Allster_102_091416_7 instead of Ship_Allster_102_091416_7(1)
private int GetCounterFromFileName(string zipFileName)
{
zipFileName = "Ship_Allster_102_091416_7(1)";
// i want to Ship_Allster_102_091416_7 like this
int num = 0;
if (!string.IsNullOrEmpty(zipFileName))
{
try
{
string[] strArray = zipFileName.Substring(0, zipFileName.LastIndexOf(".")).Split('_');
num = Convert.ToInt32(strArray[strArray.Length - 1]);
}
catch (Exception ex)
{
// MessageBox.Show("Exception catch here - details : " + ex.ToString());
System.IO.File.AppendAllText("logfile.txt", "Error-" + (object)DateTime.Now + ex.Message + Environment.NewLine + ex.StackTrace);
}
}
return num;
}