среда, 24 сентября 2014 г.

Preparing to MS Exam 70-483 - Validate application input

The full set of questions I'm trying to cover in time of my preparation to MS Exam 70-483  you can find here.

Triggering validation

The main triggers for validation activation can serve:
  • Keystroke validation
  • Field(or other input element) Validation
  • Form Validation

To validate data we can use built-in functions as

  • Parse, TryParse methods
  • String methods
    • Contains
    • EndsWith / StartsWith
    • IndexOf
    • IndexOfAny
    • IsNullOrEmpty
    • UsNullOrWhitespace
    • LastIndexOf
    • LastIndexOfAny
    • Remove
    • Replace
    • Split
    • Substring
    • ToLowet
    • ToUpper
    • Trim
    • TrimStart
    • TrimEnd
  • DateTime methods
  • Regular Expressions
    • IsMatch
    • Match
    • Matches
    • Replace
    • Split
NOTE
You should not forgot about sanitty checks and with this can help Debug.Assert method or If-clause throwing and exception when some values are inapropriate from the point of view of logic.

Regular Expressions 

Examples