Skip to content

Commit 087995c

Browse files
gibson042leobalter
authored andcommitted
Editorial: Improve IsWellFormedUnitIdentifier algorithm steps
1 parent af1c4bd commit 087995c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spec/locales-currencies-tz.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,17 @@ <h1>IsWellFormedUnitIdentifier ( _unitIdentifier_ )</h1>
235235
</p>
236236

237237
<emu-alg>
238-
1. If the result of IsSanctionedSimpleUnitIdentifier(_unitIdentifier_) is *true*, then
238+
1. If ! IsSanctionedSimpleUnitIdentifier(_unitIdentifier_) is *true*, then
239239
1. Return *true*.
240-
1. If the substring *"-per-"* does not occur exactly once in _unitIdentifier_, then
240+
1. Let _i_ be ! StringIndexOf(_unitIdentifier_, *"-per-"*, 0).
241+
1. If _i_ is -1 or ! StringIndexOf(_unitIdentifier_, *"-per-"*, _i_ + 1) is not -1, then
241242
1. Return *false*.
242-
1. Let _numerator_ be the substring of _unitIdentifier_ from the beginning to just before *"-per-"*.
243-
1. If the result of IsSanctionedSimpleUnitIdentifier(_numerator_) is *false*, then
244-
1. Return *false*.
245-
1. Let _denominator_ be the substring of _unitIdentifier_ from just after *"-per-"* to the end.
246-
1. If the result of IsSanctionedSimpleUnitIdentifier(_denominator_) is *false*, then
247-
1. Return *false*.
248-
1. Return *true*.
243+
1. Assert: The five-character substring *"-per-"* occurs exactly once in _unitIdentifier_, at index _i_.
244+
1. Let _numerator_ be the substring of _unitIdentifier_ from 0 to _i_.
245+
1. Let _denominator_ be the substring of _unitIdentifier_ from _i_ + 5.
246+
1. If ! IsSanctionedSimpleUnitIdentifier(_numerator_) and ! IsSanctionedSimpleUnitIdentifier(_denominator_) are both *true*, then
247+
1. Return *true*.
248+
1. Return *false*.
249249
</emu-alg>
250250
</emu-clause>
251251

0 commit comments

Comments
 (0)