How to remove text in a string variable

@Kindergarden
Please refer this.

like this.