Version:
  1. Script objects OG.TextUtils

    Article: AN0002194 Updated: 29.03.2019 Displayed: 82x

    This object offers functions for work with a text.

    Script functions

    Name Description
    string ReplaceBracketCommand( string text, string prefix, string format, object par3, object par4) Function replaces bracket commands in a text.
    ParseText CreateParseText() Function returns object ParseText for text parsing.
    FindParse CreateFindParse() Function returns object FindParse for parsing the text to elements.
    PasswordCheck CreatePasswordCheck(string password) Function returns object PasswordCheck for password check.
    DottedText CreateDottedText() Function returns object DottextText.
    DottedText CreateDottedText(int minNumbers, int maxNumbers, int maxNumberLength) Function returns object DottextText.
    string ToBase64(byte[] bytes) Function converts byte array to a string in Base64 encoding.
    byte[] FromBase64(string text) Function converts string in Base64 encoding to a byte array.
    List ConvertToList(string values, char separator) Function converts numeric values stored in a text to collection of integers.
    string ConvertPersonsToSeparatedString(PersonInfoList personInfoList, string separator, string envelope) Function creates text from full names of users, encloses them into text  envelope and separates them by characters stated in the parameter separator.
    string ConvertEntitiesToSeparatedString(EntityInfoList entityList, string separator, string envelope) Function creates text from names of entities that will be enclosed in text envelope and separates them by characters stated in the parameter separator.
    string ConvertStringsToSeparatedString(StringCollection list, string separator, string envelope) Function creates text from texts that will be enclosed in text envelope and separates them by characters stated in the parameter separator.
    string ConvertIntToSeparatedString(List list, string separator, string envelope) Function creates text from integers, encloses them into text  envelope and separates them by characters stated in the parameter separator.
    string ConvertColumnToSeparatedString(DataRowList drList, ColumnClassDef column, string separator, string envelope) Function creates text from Datarow values of the defined column. Particular values are enclosed in text envelope and separated by characters stated in the parameter separator.
    bool Compare(List list1, List list2) Function checks whether two collections are identical.
    string UrlEncode(string url) Function encodes text in URL.
    string UrlDecode(string url) Function decodes text in URL.
    string HtmlEncode(string text) Function encodes text in HTML.
    string HtmlDecode(string text) Function decodes text in HTML.
    string CompareTwoHtml(string oldHtml, string newHtml) Function compares two HTML texts and returns comparison results.

    Function is available in more variants for various number of parameters par1...par20:

    string Format(string format, object par1)

    ...

    string Format(string format, object par1, object par2, object par3, object par4, object par5, object par6, object par7, object par8, object par9, object par10, object par11, object par12, object par13, object par14, object par15, object par16, object par17, object par18, object par19, object par20)

    Function formats the text according to the format and parameters that were passed. The format is based on .NET function String.Format.

    The function for bracket commands enables to add a text command that will be replaced by a particular value at processing/displaying. This function is used e.g. in model Knowledge Base at article displaying.

    Object call

    OG.TextUtils

     

    The script shows how to compare two HTML columns and display result for comparison.

    var cl = OGModel.ClassDefs.GetById( OGActualDataRowParentId);

    var c1 = cl.Columns['text'];
    var c2 = cl.Columns['new_text'];

    var h1 = OGForm.GetControl( c1.Id).GetData();
    var h2 = OGForm.GetControl( c2.Id).GetData();

    var s = OG.TextUtils.CompareTwoHtml(h1, h2);
    OGForm.JavaScript.ShowHtmlDialog( 'Comparison of article versions', s);

  2.    ---
    Your rating:
    Rated by users: 0x
  3. Top
SearchTitle
×