StdUtil improvement

1. Extract vectorContains from rules into StdUtil
2. Make toString extensible
3. Modify related rules to use new StdUtil
Format changes
Leverage template functions to replace #define code
Extract violating conditions into separate methods