convertToString: Segement terminator

Hi Gurus,

I need some help from you guys. On EDI when i do convertToString i want make the file unwrapped and add ~ as segement terminator… right now i am able to do just one either unwrap or ~ . How do i do both?
Ex:
ST204~
B2AAAA11111**PP~
SE
323~

Thank you.