Add an additional argument to let the client pass the possible end chars.
Move the local implementation from adb functions to the string util functions.
Simplify naming.