Skip to content

Commit

Permalink
fixing issue with commas between numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
reZach committed Jun 15, 2018
1 parent 91695cc commit 9564924
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,17 @@ function Grammarify_PreProcess(){
badMatchesIndex = input.indexOf(badMatches[i], badMatchesIndex);

tempSearch = input.substr(badMatchesIndex);
tempSearch = tempSearch.replace(badMatches[i], (charToFix + " "));

// Corner-case;
// don't add space if fixing this
// 3,,000
if (badMatchesIndex + badMatches[i].length < input.length &&
input[badMatchesIndex + badMatches[i].length + 1].match(/\d/) !== null){
tempSearch = tempSearch.replace(badMatches[i], charToFix);
} else {
tempSearch = tempSearch.replace(badMatches[i], (charToFix + " "));
}

input = input.substr(0, badMatchesIndex) + tempSearch;

badMatchesIndex++;
Expand Down

0 comments on commit 9564924

Please sign in to comment.