Skip to content

Instantly share code, notes, and snippets.

@fitnr
fitnr / address-splitter.js
Last active February 6, 2021 01:45
Split an address into number and street parts
// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric/1830844#1830844
function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); }
// Check if character is a fraction, e.g. ¼
function isFractionalChar(n) {
c = n.charCodeAt();
return (c >= 188 && c <= 190) || (c >= 8531 && c <= 8542);
}
// return the first fractional character in a string