Newel Software LLC.
Software Development
and
IT Solutions
You may enter your comments and feedback here. We will contact you or respond to your questions as soon as possible.
Tips and Tricks
It is easy to find a the position of a chr in another string using the below function.
public static int Findstring(string input, string chrtolook)
{
//find the first / in the path string
int ret = 0;
for (int i = input.Length - 1; i >= 0; i--)
{
if (input.Substring(i, 1) == chrtolook)
{ ret = i + 1; break;
}
}
return ret;
}
public static DateTime ConvertFromUnixTimestamp(long timestamp)
{
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
return origin.AddMilliseconds(timestamp);
}
public static string readTextFile(string sFiletoread)
{
string sRetText = "";
try
{
using (StreamReader sr = new StreamReader(sFiletoread))
{
sRetText = sr.ReadToEnd();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString()); sRetText = e.ToString();
}
return sRetText;
}