4D v16.3ST Get plain text |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
ST Get plain text
ST Get plain text
The ST Get plain text command removes any style tags from the text variable or field designated by the * and object parameters and returns the plain text. If you pass the optional * parameter, this indicates that the object parameter is an object name (string). During execution, if the object has the focus, the command returns information about the object being edited; however, when the object does not have the focus, the command returns information about the data source (field or variable) of the object. The optional refMode parameter indicates the way that references found in object must be returned. In refMode, pass one of the following constants, found in the "Multistyle Text" theme (you can pass a single constant or a combination):
Note: Since plain text remains the same regardless of the values passed in the refMode parameter, the optional refMode parameter is only useful when the text contains references. You are looking for the text "very nice" among the values of a multistyle text field. The value was stored in the following form: "The weather is very nice today". QUERY BY FORMULA([Comments];ST Get plain text([Comments]Weather)="@very nice@")
Note: In this context, the following statement will not give the desired result because the text is saved with style tags: QUERY([Comments];[Comments]Weather="@very nice@") Given the following text placed in the multi-style area entitled "MyArea": <span>It is now <span style="-d4-ref:'Current time:C178'"> </span> <a href="http://www.4d.com">Go to the 4D site</a> or <span style="-d4-ref-user:'openW'">Open a window</span></span> This text is displayed: If you execute the following code: $txt :=ST Get plain text(*;"myArea";ST References as spaces) After this command is executed, the OK variable is set to 1 if no error occurred; otherwise, it is set to 0. This is the case more particularly when style tags are not evaluated properly (incorrect or missing tags). In the case of an error, the variable is not changed. When an error occurs on a variable when text is being evaluated, 4D transforms the text into plain text; as a result, the <, > and & characters are converted into HTML entities.
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v12 TAGS multi-style, multistyle, multi style ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||