How do you get the message from the following inputs
Input is formated by field name separated by comma, followed by a colon, space and then the error message.
<FieldName1>, <FieldName2>, <FieldName3>: <ErrorMessage>"
Input Example
"ConsumerSecret, ConsumerKey: Invalid application credentials"
"Password: Invalid Must contain at least one alpha, one numeric, and one special character"
Method
string Message GetErrorByField (string FieldName, string InputString);
1
ErrorMessage = GetErrorByField("ConsumerSecret", "ConsumerSecret, ConsumerKey: Invalid application credentials");
ErrorMessage should now equal
"Invalid application credentials".
2
ErrorMessage = GetErrorByField("ConsumerKey", "ConsumerSecret, ConsumerKey: Invalid application credentials");
ErrorMessage should now equal
"Invalid application credentials".
3
ErrorMessage = GetErrorByField("Password", "Password: Invalid Must contain at least one alpha, one numeric, and one special character");
ErrorMessage should now equal
"Invalid Must contain at least one alpha, one numeric, and one special character".
Split the
InputStringi.e., second parameter inGetErrorByField()method by:then you will get the result by considering the splitted string with index 1