Skip to content

CharCount - DfBaseRichEdit

Returns length of RTF stream in the control

Type: Function
Return Data Type: integer

Syntax

Function CharCount Returns integer

Call Example

Get CharCount to integerVariable

Description

Returns the length of the RTF stream in the control.

This function counts each line break as 2 characters (a linefeed character (ASCII 10) followed by a carriage return character (ASCII 13).

Sample

integer iStreamLength
get CharCount to iStreamLength

Sample

This sample sets the contents of the oRichEdit1 control to "Some RTF text". It then gets the content (RTF stream) to variable sRTFStream and its length to variable iCharCount. Last, it displays the RTF stream and it's length in a message box to the user.

Procedure DisplayText
    string sText sRTFStream
    integer iCharCount

    move "Some RTF text" to sText
    set Value of oRichEdit1 to sText

    get Value of oRichEdit1 to sRTFStream
    get CharCount of oRichEdit1 to iCharCount

    send Info_Box sRTFStream (string(iCharCount) + " characters in RTF stream")
End_Procedure  // DisplayText
Col 1 Col 2
Note: It can take a while to retrieve the charcount. For example, if you insert an image into the control from the clipboard, the amount of characters may increase tremendously, depending on the size of the image.

Return Value

Length of the RTF stream in the control.