Factor common string validators into common method

Change-Id: I53883a7921dea368ed8b38aa7513cbbd0f488964
Merge "Factor common string validators into common method"