Extract common method for muti-line strings