• Have a look in Books Online regarding "String Functions". There's one there that does exactly what you want.