1. Script objects OG.TextUtils

    Artikel: AN0002194Aktualisiert: 08.11.2018
    Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.

    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.

    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);

×