文字置換ツール 2.0

[diary:174622]
[beforeExec]
sc = function(s){ return s.replace(/^ +| +$/g, "").replace(/ {2,}/g, " "); };
eco = function(){
var ex = echo("sel1"), o1 = Fid("txt1"), o2 = Fid("txt2"), o3 = Fid("txt3");
var s1 = echo(o1), s2 = echo(o2), s3 = echo(o3), s = "", a,b,c,n,j;

switch(ex){
case "1" :
a = sc(s1).split(" ");
s = " ", c = "";
for(i = 0; i < a.length; i++){
b = a[i];
if(s.indexOf(" " + b + " ") == -1) s += b + " ";
else c += b + " ";
}
s = sc(s).split(" "); s.sort();
echo(o2, s.join(" "));
echo(o3, sc(c)); break;
case "2" :
echo(o2, encodeURIComponent(echo(o1)));
}

};

[/beforeExec]
[cssText]
.topMsg { margin:.5em 1em 0 1em; }
.topMsg a { font:bold 120%/1.0 "Times New Roman"; text-decoration:none; }
.topMsg a:hover { color:magenta; text-decoration:underline; }
.w90 { font-size:90%; }

#F5 { margin:.5em 1em; }
#F5 textarea { width:100% }
[/cssText]
[body]
<$$form name="F5" id="F5" onsubmit="return false">
<$$div class="topMsg">
<$$a href="main.html?diary=174622">SRT 2.0<$$/a>
<select class="w90" id="sel1">
<option value="1">重複文字列排除 空白区切り</option>
<option value="2">encodeURIComponent</option>
</select><input class="w90" type="button" onclick="eco()" value="実行" />
<$$/div>


<$$div>
<$$textarea id="txt1" cols="80" rows="6" wrap="soft"><$$/textarea>
<$$/div>
<$$div >
<$$textarea id="txt2" cols="80" rows="6" wrap="soft"><$$/textarea>
<$$/div>
<$$div >
<$$textarea id="txt3" cols="80" rows="4" wrap="soft"><$$/textarea>
<$$/div>

<$$/form>

[/body]
[exec]
document.title = "文字置換ツール 2.0";
[/exec]
[/diary:174622]


■仕様書 2010 11/21 150:30 Wrote