string - How to add space between numbers, with DisplayFormat -


how can add spaces between numbers displayformat.

like example:

50130301037855000150550010000000131000000132 

i'm need this:

5013 0301 0378 5500 0150 5500 1000 0000 1310 0000 0132 

anyone have idea? thanks.

you can not format using displayformat property, can rely on ongettext event make happen.

i'm assuming field of string type, example:

function insertblankeach4chars(s: string): string; begin   result := '';   while s <> ''   begin     result := result + copy(s, 1, 4) + ' ';     delete(s, 1, 4);   end;   result := trim(result); end;  procedure tmyform.myqueryfieldgettext(sender: tfield;   var text: string; displaytext: boolean); begin   if displaytext     text := insertblankeach4chars(sender.asstring)   else     text := sender.asstring; end; 

disclaimer: code written in browser , not tested. if you're going use in time-sensitive process, warn function may optimized better performance.


Comments