Skip to content

Instantly share code, notes, and snippets.

Leonardo Sancho lsancho

Block or report user

Report or block lsancho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lsancho
lsancho / NotAllowedCharacters.cs
Created Apr 19, 2018
used to remove characters not allowed in product names
View NotAllowedCharacters.cs
using System.Text.RegularExpressions;
namespace Utils.Text
{
public static class NotAllowedCharacters
{
private const string AccentsCharactersAllowed = "áéíóúâêîôûãõàèìòùäëïöüçñÁÉÍÓÚÂÊÎÔÛÃÕÀÈÌÒÙÄËÏÖÜÇÑ`´";
private const string SpecialCharactersAllowed = "-+÷\\/><=≠.,:;\'\"!¡?¿{}[]()@#*&€$%*°ºª²³⅓⅔⅛⅜⅝⅞_";
public static bool Contains(string text)
@lsancho
lsancho / Isbn13Validation.cs
Created Oct 23, 2015
Validates ISBN13 codes
View Isbn13Validation.cs
/// <summary>
/// Validates ISBN13 codes
/// </summary>
/// <param name="isbn13">code to validate</param>
/// <returns>true, if valid</returns>
public static bool IsValidIsbn13(string isbn13)
{
if (string.IsNullOrEmpty(isbn13))
{
return false;
View CountryEnum.cs
///<sumary>
/// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
///</sumary>
public enum Country {
///<sumary>
/// Andorra
///</sumary>
AD,
///<sumary>
/// United Arab Emirates
@lsancho
lsancho / GetAllMessagesFromException.cs
Created Jul 3, 2015
Get All InnerException Messages
View GetAllMessagesFromException.cs
public static IEnumerable<TSource> FromHierarchy<TSource>(
this TSource source,
Func<TSource, TSource> nextItem,
Func<TSource, bool> canContinue)
{
for (var current = source; canContinue(current); current = nextItem(current))
{
yield return current;
}
}
You can’t perform that action at this time.