EstecheAssemblies 1.0.5
Good functionalities, such as:
FriendlyTimeSpan: Transforming the TimeSpan of the difference between an x DateTime and now into a friendly text. E.g. "00:00:04" = "4 minutes ago" or “00:05:32” = “5 hours ago”. (So far it is available in English, Chinese, Spanish and Swedish.)
Futhermore is including: IsDateTime, IsGuid, IsAbsNumeric and IsSwedishPersonalNumber
See the version list below for details.
Install-Package EstecheAssemblies -Version 1.0.5
dotnet add package EstecheAssemblies --version 1.0.5
<PackageReference Include="EstecheAssemblies" Version="1.0.5" />
paket add EstecheAssemblies --version 1.0.5
#r "nuget: EstecheAssemblies, 1.0.5"
// Install EstecheAssemblies as a Cake Addin
#addin nuget:?package=EstecheAssemblies&version=1.0.5
// Install EstecheAssemblies as a Cake Tool
#tool nuget:?package=EstecheAssemblies&version=1.0.5
Introduction
Good functionalities for developers.
Content
DateTime Extensions
ToFriendlyTimeSpan(Language)
Returns a friendly text on the TimeSpan got it for this DateTime until Now.
E.g. "00:00:04" = "4 minutes ago" or “00:05:32” = “5 hours ago”
It is available in English, Chinese, Spanish and Swedish.
ToShortFriendlyTimeSpan(Language)
Returns a shorter friendly text on the TimeSpan got it for this DateTime until Now.
E.g. "00:00:04" = "4 min" or “00:05:32” = “5 hr”
It is available in English, Spanish and Swedish. The Chinese has no shorter version.
String Extensions
IsAbsNumeric()
Returns a bool telling if a String is an absolut entire number
IsDateTime()
Returns a bool telling if a String is a DateTime and returns the value parsed in case it is correct.
IsGuid()
Returns a bool telling if a String is a DateTime and returns the value parsed in case it is correct.
IsSwedishPersonalNumber()
This is a functionality used in Sweden for validating a personal number (Social Security number)
Returns a bool telling if a String is a correct Swedish Personal Number and in case of Not, it returns the Error Message.
ToSecureString()
This functionality convert a string to a SecureString
ToPlanString()
This convert a SecureString to a string
ToUpperFirstChar()
This turn the first char in a string to UpperCase
IsEqualTo(SecureString comparingSecureString)
This function compare is this "SecureString" is equeal to a comparing one.
Good to know
This package is free for everyone to use.
It is open source wroten in C# allocated in AzureRepo: https://dev.azure.com/fuestechefamily/EstecheAssemblies/_git/EstecheAssemblies
Implementation
Add using
using EstecheAssemblies;
ToFriendlyTimeSpan(Language)
var date = new DateTime("2019-08-08 01:03:21");
var friendlyTextEnglish = date.ToFriendlyTimeSpan(Language.English);
var friendlyTextSimplifiedChinese = date.ToFriendlyTimeSpan(Language.SimplifiedChinese);
var friendlyTextTraditionalChinese = date.ToFriendlyTimeSpan(Language.TraditionalChinese);
var friendlyTextSwedish = date.ToFriendlyTimeSpan(Language.Swedish);
var friendlyTextSpanish = date.ToFriendlyTimeSpan(Language.Spanish);
var friendlyTextEnglishDefault = date.ToFriendlyTimeSpan();
ToShortFriendlyTimeSpan(Language)
var date = new DateTime("2019-08-08");
var shorterFriendlyTextEnglish = date.ToShortFriendlyTimeSpan(Language.English);
var shorterFriendlyTextSimplifiedChinese = date.ToShortFriendlyTimeSpan(Language.SimplifiedChinese);
var shorterFriendlyTextTraditionalChinese = date.ToShortFriendlyTimeSpan(Language.TraditionalChinese);
var shorterFriendlyTextSwedish = date.ToShortFriendlyTimeSpan(Language.Swedish);
var shorterFriendlyTextSpanish = date.ToShortFriendlyTimeSpan(Language.Spanish);
var shorterFriendlyTextEnglishDefault = date.ToShortFriendlyTimeSpan();
ToSecureString()
var myPassword = "My Password";
SecureString mySecureString = myPassword.ToSecureString();
ToPlanString()
string myStringPassword = mySecureString.ToPlanString();
ToUpperFirstChar
var myText = "it's a beutifull life";
string betterFormatedText = myText.ToUpperFirstChar();
IsEqualTo(SecureString comparingSecureString)
SecureString mySecureString = "it_is_my_Password".ToSecureString();
SecureString mySecureString2 = "it_is_my_Password".ToSecureString();
bool correctPassword = mySecureString.IsEqualTo(mySecureString2);
IsDateTime()
var text = "2019-08-08-68";
var validDate = text.IsDateTime();
IsGuid()
var text = "6B1A5C52-E10C-471C-422309EC06A1";
var validGuid = text.IsGuid();
IsAbsNumeric()
var text = "6B1A5C52";
var validNumber = text.IsAbsNumeric();
IsAbsNumeric()
var text = "121212-1212";
var validNumber = text.IsSwedishPersonalNumber();
Introduction
Good functionalities for developers.
Content
DateTime Extensions
ToFriendlyTimeSpan(Language)
Returns a friendly text on the TimeSpan got it for this DateTime until Now.
E.g. "00:00:04" = "4 minutes ago" or “00:05:32” = “5 hours ago”
It is available in English, Chinese, Spanish and Swedish.
ToShortFriendlyTimeSpan(Language)
Returns a shorter friendly text on the TimeSpan got it for this DateTime until Now.
E.g. "00:00:04" = "4 min" or “00:05:32” = “5 hr”
It is available in English, Spanish and Swedish. The Chinese has no shorter version.
String Extensions
IsAbsNumeric()
Returns a bool telling if a String is an absolut entire number
IsDateTime()
Returns a bool telling if a String is a DateTime and returns the value parsed in case it is correct.
IsGuid()
Returns a bool telling if a String is a DateTime and returns the value parsed in case it is correct.
IsSwedishPersonalNumber()
This is a functionality used in Sweden for validating a personal number (Social Security number)
Returns a bool telling if a String is a correct Swedish Personal Number and in case of Not, it returns the Error Message.
ToSecureString()
This functionality convert a string to a SecureString
ToPlanString()
This convert a SecureString to a string
ToUpperFirstChar()
This turn the first char in a string to UpperCase
IsEqualTo(SecureString comparingSecureString)
This function compare is this "SecureString" is equeal to a comparing one.
Good to know
This package is free for everyone to use.
It is open source wroten in C# allocated in AzureRepo: https://dev.azure.com/fuestechefamily/EstecheAssemblies/_git/EstecheAssemblies
Implementation
Add using
using EstecheAssemblies;
ToFriendlyTimeSpan(Language)
var date = new DateTime("2019-08-08 01:03:21");
var friendlyTextEnglish = date.ToFriendlyTimeSpan(Language.English);
var friendlyTextSimplifiedChinese = date.ToFriendlyTimeSpan(Language.SimplifiedChinese);
var friendlyTextTraditionalChinese = date.ToFriendlyTimeSpan(Language.TraditionalChinese);
var friendlyTextSwedish = date.ToFriendlyTimeSpan(Language.Swedish);
var friendlyTextSpanish = date.ToFriendlyTimeSpan(Language.Spanish);
var friendlyTextEnglishDefault = date.ToFriendlyTimeSpan();
ToShortFriendlyTimeSpan(Language)
var date = new DateTime("2019-08-08");
var shorterFriendlyTextEnglish = date.ToShortFriendlyTimeSpan(Language.English);
var shorterFriendlyTextSimplifiedChinese = date.ToShortFriendlyTimeSpan(Language.SimplifiedChinese);
var shorterFriendlyTextTraditionalChinese = date.ToShortFriendlyTimeSpan(Language.TraditionalChinese);
var shorterFriendlyTextSwedish = date.ToShortFriendlyTimeSpan(Language.Swedish);
var shorterFriendlyTextSpanish = date.ToShortFriendlyTimeSpan(Language.Spanish);
var shorterFriendlyTextEnglishDefault = date.ToShortFriendlyTimeSpan();
ToSecureString()
var myPassword = "My Password";
SecureString mySecureString = myPassword.ToSecureString();
ToPlanString()
string myStringPassword = mySecureString.ToPlanString();
ToUpperFirstChar
var myText = "it's a beutifull life";
string betterFormatedText = myText.ToUpperFirstChar();
IsEqualTo(SecureString comparingSecureString)
SecureString mySecureString = "it_is_my_Password".ToSecureString();
SecureString mySecureString2 = "it_is_my_Password".ToSecureString();
bool correctPassword = mySecureString.IsEqualTo(mySecureString2);
IsDateTime()
var text = "2019-08-08-68";
var validDate = text.IsDateTime();
IsGuid()
var text = "6B1A5C52-E10C-471C-422309EC06A1";
var validGuid = text.IsGuid();
IsAbsNumeric()
var text = "6B1A5C52";
var validNumber = text.IsAbsNumeric();
IsAbsNumeric()
var text = "121212-1212";
var validNumber = text.IsSwedishPersonalNumber();
Release Notes
* Adjusted English text on Date older than 1 month.
Dependencies
-
.NETStandard 2.0
- No dependencies.
Used By
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EstecheAssemblies:
Package | Downloads |
---|---|
BlazorMarkdown2Html
Display markdown files in html format directly in a Blazor with a component.
The only think a developer need to do it is to add the path to the file e.g. "ReadMe.md" into the parameter "documentName" and the rest it is handled by the component. If you give the default css it even handle dark and light mode heritated from the webbrowser.
|
GitHub repositories
This package is not used by any popular GitHub repositories.