Flatfile space issue after each bunch of header and detail records. If I use Trim service it only removes first and last spaces. Please let me know any other alternatives

Hi,

Could someone please help me in removing the space after each bunch of header and detail records. My final output is a string. Please refer the example below

Eg:
H~abc~def~
D~ghi~ijk
D~lmn~opq

H~abc~def~
D~ghi~ijk
D~lmn~opq

H~abc~def~
D~ghi~ijk
D~lmn~opq

Hi Jagadish,

can you provide an example of the expected and recent output strings please?

You might want to use some special character where the spaces are/should be, so it becomes easier us to check your example.

Regards,
Holger