複数行文字列, 特定行の取得

複数行文字列, 特定行の取得 (Multiline String, Get Specific Line)

複数行文字列の特定の1行を取得します。行IDの指定は0で始まります。

(C) Questetra, Inc. (MIT License)
https://support.questetra.com/ja/addons/multiline-string-get-specific-line/

Configs
  • A: 複数行テキストが格納されている文字列型データ項目を選択してください *
  • B: 参照する行IDをセットしてください (例 “0”) * #{EL}
  • C: 取得された単一行テキストが格納される文字列型データ項目を選択してください(更新) *
Script (click to open)

// (c) 2019, Questetra, Inc. (the MIT License)

//////// START "main()" ////////
main();
function main(){ 


//// == Config Retrieving / 工程コンフィグの参照 ==
const dataIdA = configs.get( "conf_DataIdA" ) + ""; // config required
const lineId  = configs.get( "conf_LineId" )  + ""; // config required
const dataIdC = configs.get( "conf_DataIdC" ) + ""; // config required
const intLineId = parseInt( lineId );
// Design-time Config Format Check
if ( isNaN( intLineId )){
  throw new Error( "\n AutomatedTask UnexpectedConfigError:" +
                   " Config LineID is not an integer \n" );
}


//// == Data Retrieving / ワークフローデータの参照 ==
// Run-time Data Format Check
if( engine.findDataByNumber( dataIdA ) === null ){
  throw new Error( "\n AutomatedTask UnexpectedStringError:" +
                   " String {A} is null \n" );
}
const inputText = (engine.findDataByNumber( dataIdA ) + "");


//// == Calculating / 演算 ==
const arrInputText = inputText.split("\n");
engine.log( " AutomatedTask MultilineString:" + 
            " String {A}, number of lines " + arrInputText.length );
let   outputText = arrInputText[ intLineId ];


//// == Data Updating / ワークフローデータへの代入 ==
engine.setDataByNumber( dataIdC, outputText );


} //////// END "main()" ////////

Download

Capture

See also

複数行文字列, 行数の取得

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

Questetra Supportをもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む

上部へスクロール