Last active
April 14, 2017 18:37
-
-
Save leandromoh/3d1f02bbac38c6c2977c898d6af7b910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string FormatAsCNPJ(this string str) | |
{ | |
long number; | |
return long.TryParse(str, out number) ? number.ToString(@"00\.000\.000\/0000\-00") : null; | |
} | |
public static string FormatAsCPF(this string str) | |
{ | |
long number; | |
return long.TryParse(str, out number) ? number.ToString(@"000\.000\.000\-00") : null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment