Added GetHumanReadable for TimeSpan & FirstLetterToUpper
This commit is contained in:
parent
fa7289365b
commit
579e7b93c0
1 changed files with 14 additions and 0 deletions
|
|
@ -402,6 +402,15 @@ public static class UniversalExtensions
|
||||||
public static string GetHumanReadable(this long seconds, TimeFormat timeFormat = TimeFormat.DAYS) =>
|
public static string GetHumanReadable(this long seconds, TimeFormat timeFormat = TimeFormat.DAYS) =>
|
||||||
TimeSpan.FromSeconds(seconds).GetTimeFormat(timeFormat);
|
TimeSpan.FromSeconds(seconds).GetTimeFormat(timeFormat);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <inheritdoc cref="UniversalExtensions.GetHumanReadable(int, TimeFormat)"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeSpan"></param>
|
||||||
|
/// <param name="timeFormat"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetHumanReadable(this TimeSpan timeSpan, TimeFormat timeFormat = TimeFormat.DAYS) =>
|
||||||
|
timeSpan.GetTimeFormat(timeFormat);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -489,4 +498,9 @@ public static class StringExt
|
||||||
using SHA256 _SHA256 = SHA256.Create();
|
using SHA256 _SHA256 = SHA256.Create();
|
||||||
return BitConverter.ToString(_SHA256.ComputeHash(Encoding.ASCII.GetBytes(str))).Replace("-", "").ToLowerInvariant();
|
return BitConverter.ToString(_SHA256.ComputeHash(Encoding.ASCII.GetBytes(str))).Replace("-", "").ToLowerInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string FirstLetterToUpper(this string str)
|
||||||
|
{
|
||||||
|
return $"{str.First().ToString().ToUpper()}{str.Remove(0, 1)}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue