How to insert literals in a TfrxMemoView

I have an 8 digit value that I want to display in a TfrxMemoView with a dash "-" inserted between every two digits. For example the original value coming from the data field is 12345678 and I want it to be displayed as 12-34-56-78. How can I achive this. Obviously I have to use FormatStr property but could ot figure it out.

Can someone provide me the FormatStr to achive the above result, or suggest some other solution.

Comments

  • renerene Prague, Czech Republic, Europe
    edited 7:02PM
    First idea: If it has fixed length try to use Copy function like:
    var
      mytext: string;
    
    ...
    
    { Handler: OnBeforePrint }
    begin
      mytext := <GET_FIELD_TEXT_IN_HERE>;
      mytext := Copy(mytext, 1, 2) + '-' + Copy(mytext, 3, 2) + '-' + Copy(mytext, 5, 2) + '-' + Copy(mytext, 7, 2);
    end;
    

    But maybe it could be done more sofisticated way by MaskEdit or FormatStr aso.
  • edited 7:02PM
    It is not a fixed size field therefore this approach wouldn'g work.

    Still waiting for someone to help in using the FormatStr to insert literals in a string in specific places.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.