Memo field string need to split
Posted on 2014-10-28
In Crystal Report XI R2 I have a memo filed that has text in.
I need to split this text in two fields. For this I was thinking about creating two formulas.
Usually in the middle of text there is Chr(13) and Chr(10). It looks easy to solve this, just use InStr to find its position and then use left or right function to pull out first part of text then second part.
However or but.
Problem is that user entering text sometimes put two times Chr(13),Chr(10),Chr(13),Chr(10) in the middle of text.
Sometimes he is putting chr(160) in too and it looks …..Chr(13),Chr(10),Chr(160),Chr(13),Chr(10)…
Sometimes user start text with Chr(13),Chr(10) or Chr(160) or he first enters tab Chr(9) then start to enter text.
I need to remove all from left side(beginning of text e.g.Chr(13),Chr(10),Chr(9),Chr(160)).
I need text starts with capitalizing first letter of text. I need to find first occurrence of Chr(13),Chr(10) then extract text before that .
Then in need to remove eventually Chr(13),Chr(10) or Chr(160) or Chr(9) from beginning of second part of text .For the second part of text I have to cut everything after end of text as user could put Chr(13),Chr(10),Chr(9) or Chr(160) there too.That second part of text has to go to second formula.