Answers for "javascript format social security number"

0

javascript format social security number

function formatSocialSecurity(val){
	val = val.replace(/\D/g, '');
	val = val.replace(/^(\d{3})/, '$1-');
	val = val.replace(/-(\d{2})/, '-$1-');
	val = val.replace(/(\d)-(\d{4}).*/, '$1-$2');
	return val;
}  		
formatSocialSecurity("135711458");//"135-71-1458"
Posted by: Guest on August-21-2019

Code answers related to "javascript format social security number"

Code answers related to "Javascript"

Browse Popular Code Answers by Language