You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Validator {
String validateEmail(String value) {
Pattern pattern =
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
RegExp regex = new RegExp(pattern);
if (value.length == 0 ) {
return "Email tidak boleh kosong";
} else if (!regex.hasMatch(value)) {
return 'Email tidak valid';
}
return null;
}
String validatePassword(String value) {
String pattern = r'(^[a-zA-Z0-9]*$)';
RegExp regExp = new RegExp(pattern);
if (value.length == 0) {
return "Password tidak boleh kosong";
} else if(value.length < 8){
return "Password tidak boleh kurang dari 8";
} else if(value.length > 15) {
return "Password tidak boleh lebih dari 15";
} else if (!regExp.hasMatch(value)) {
return "Password harus menggunakan alfanumerik";
}
return null;
}
}
How to translate the value of return String?
The text was updated successfully, but these errors were encountered:
I have the class for validation like here:
How to translate the value of return String?
The text was updated successfully, but these errors were encountered: