文字列取得系

現在、3 つのサブルーチンが公開されています。


01.Separation_left
【説明】
//セパレータの左部分を抜き出す
//$1=セパレータの入った文字列
//$2=セパレータ(";"や":"など)
【ソース】
Separation_left:
    ##num = strstr($1,$2);
    $str = leftstr($1,##num);
    return $str;
【使用例】
$str = "index.htm(10):";

call Separation_left $str, "(" ;
$leftstr = $return;
insert $leftstr + "\n";    //index.htm
【備考】
-
02.Separation_right
【説明】
//セパレータの右部分を抜き出す
//$1=セパレータの入った文字列
//$2=セパレータ(";"や":"など)

【ソース】
Separation_right:
    ##num = strstr($1,$2);
    $str = midstr($1,##num + strlen($2),strlen($1) - ##num);
    return $str;
【使用例】
$str = "index.htm(10):";

call Separation_right $str, "htm" ;
$rightstr = $return;
insert $rightstr + "\n";    //(10):
【備考】
-
03.Get_text & Re_select
【説明】
Get_text:
//選択範囲部分文字列を取得し、返す。
//引数があれば範囲選択を復元する
//引数:1(数値型)

Re_select:
//範囲選択をする
//##1 = seltopx 相当の数値
//##2 = seltopy 相当の数値
//##3 = selendx 相当の数値
//##4 = selendy 相当の数値
【ソース】
Get_text:
    $getvalue = gettext(seltopx,seltopy,selendx,selendy);

//##1があれば、範囲指定を復元する
    if(##1)    call Re_select seltopx,seltopy,selendx,selendy;
    return $getvalue;



Re_select:    //範囲選択をする
    moveto ##1,##2;
    beginsel;
    moveto ##3,##4;
    return;
【使用例】
//文字列を範囲選択して実行
call Get_text 1;
message $return;
endmacro;
【備考】
-

このページの先頭へ