feat:verify your account page ui done
This commit is contained in:
22
lib/core/helpers/string_helpers.dart
Normal file
22
lib/core/helpers/string_helpers.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
class StringHelpers {
|
||||
static String formatUzbekPhoneNumber(String input) {
|
||||
final digits = input.replaceAll(RegExp(r'\D'), '');
|
||||
|
||||
String formatted = digits;
|
||||
if (formatted.startsWith('998')) {
|
||||
formatted = formatted.substring(3);
|
||||
} else if (formatted.startsWith('8')) {
|
||||
formatted = formatted.substring(1);
|
||||
}
|
||||
|
||||
final buffer = StringBuffer('+998 ');
|
||||
for (int i = 0; i < formatted.length && i < 9; i++) {
|
||||
buffer.write(formatted[i]);
|
||||
if (i == 1 || i == 4 || i == 6) {
|
||||
buffer.write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
return buffer.toString().trim();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user