Removed extra space from end of country patterns.

This commit is contained in:
23rd 2021-09-08 14:16:47 +03:00 committed by John Preston
parent 900a7d0b2b
commit 54e76c0b71
2 changed files with 13 additions and 5 deletions

View File

@ -397,9 +397,10 @@ FormatResult CountriesInstance::format(FormatArgs args) {
}
currentPatternPos++;
}
if (!args.onlyGroups && (currentPatternPos == pattern.size())) {
result += ' ';
}
// Don't add an extra space to the end.
// if (!args.onlyGroups && (currentPatternPos == pattern.size())) {
// result += ' ';
// }
if ((currentPatternPos >= pattern.size())
|| (pattern[currentPatternPos] == 'X')) {
currentPatternPos++;

View File

@ -158,9 +158,13 @@ void PhonePartInput::correctValue(
if (leftInPart) {
--leftInPart;
} else {
newText += ' ';
++curPart;
inPart = curPart < _pattern.size();
// Don't add an extra space to the end.
if (inPart) {
newText += ' ';
}
leftInPart = inPart ? (_pattern.at(curPart) - 1) : 0;
++oldPos;
@ -389,9 +393,12 @@ void PhoneInput::correctValue(
if (leftInPart) {
--leftInPart;
} else {
newText += ' ';
++curPart;
inPart = curPart < _pattern.size();
// Don't add an extra space to the end.
if (inPart) {
newText += ' ';
}
leftInPart = inPart ? (_pattern.at(curPart) - 1) : 0;
++oldPos;