-
public class ZecStringExt
-
-
Field Summary
Fields Modifier and Type Field Description public final static ZecStringExtINSTANCE
-
Method Summary
Modifier and Type Method Description final BooleanfilterContinuous(Context context, MonetarySeparators separators, String zecString)Builds filter with current local monetary separators for continuous input checking. final BooleancheckFor3Digits(MonetarySeparators separators, String zecString)Checks for at least 3 digits between grouping separators. final BooleanfilterConfirm(Context context, MonetarySeparators separators, String zecString)Builds filter with current local monetary separators for validation of entered ZEC amount after confirm button is pressed. -
-
Method Detail
-
filterContinuous
final Boolean filterContinuous(Context context, MonetarySeparators separators, String zecString)
Builds filter with current local monetary separators for continuous input checking. The solution is built upon regex validation and other common string validation checks.
Regex example: ^(0-9(0-9+(,$|0-9+))(.$|0-9+)?)?$ Inputs may differ according to user locale.
Valid amounts: "" . | .123 | 123, | 123. | 123,456 | 123.456 | 123,456.789 | 123,456,789 | 123,456,789.123 | etc. Invalid amounts: 123,, | 123,. | 123.. | ,123 | 123.456.789 | etc.
Note that this validation handles locales with the same grouping and decimal separators, which might be required in some rare cases.
- Parameters:
context- used for loading localized pattern from strings.separators- which consist of localized monetary separatorszecString- to be validated
-
checkFor3Digits
final Boolean checkFor3Digits(MonetarySeparators separators, String zecString)
Checks for at least 3 digits between grouping separators.
- Parameters:
separators- which consist of localized monetary separatorszecString- to be validated
-
filterConfirm
final Boolean filterConfirm(Context context, MonetarySeparators separators, String zecString)
Builds filter with current local monetary separators for validation of entered ZEC amount after confirm button is pressed. The solution is built upon regex validation and other common string validation checks.
Regex example: ^(0-9{1,3}(?:,?0-9{3}))(?:0-90-9)?$ Inputs may differ according to user locale.
Valid amounts: 123 | .123 | 123. | 123, | 123.456 | 123,456 | 123,456.789 | 123,456,789 | 123,456,789.123 | etc. Invalid amounts: "" | , | . | 123,, | 123,. | 123.. | ,123 | 123.456.789 | etc.
Note that this validation handles locales with the same grouping and decimal separators, which might be required in some rare cases.
- Parameters:
context- used for loading localized pattern from strings.separators- which consist of localized monetary separatorszecString- to be validated
-
-
-
-