Characters Counter (in: String type A, out: Numeric type B)

Counts the number of characters in a text and store it in a data item. It can be used, for example, counting the number characters in original sentences in the translation work, or checking the received manuscript data.

    A. Select TEXT DATAData selectStringRequired
    B. Select NUM OF CHARACTERS DATA (update)Data selectNumericRequired
    -variable namevariable label
    Aconf_SourceTextDataIdSelect TEXT DATA
    Bconf_NumOfCharDataIdSelect NUM OF CHARACTERS DATA (update)
    //// == 自動工程コンフィグの参照 / Config Retrieving ==
    var dataIdA = configs.get("conf_SourceTextDataId");
    var dataIdB = configs.get("conf_NumOfCharDataId");
    
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var myText = data.get( dataIdA ) + "";
    
    
    //// == 演算 / Calculating ==
    var myCount = myText.replace(/\r|\n/g, "").replace(/\s+/g," ").length;
    //「改行」は文字として数えない / Not including "Line break"
    //「空白連続」は1文字として数える / Counting "consecutive spaces" as one character. 
    // 注)タブや全角空白なども「\s」に含まれる(UTF-8)
    // Note) Tab and double byte space are included in "\s" (UTF-8) 
    
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdB, java.math.BigDecimal( myCount ) );
    

    • A’: Strings stored in the selected data item A
    • The Number of characters of the Strings selected in config A’ will be stored in the Data Item selected in config B
    • Does not count Line Break code.
    • Space (including tabs and double-byte space) will be counted, but the consecutive spaces is deemed to be one character all together.