//
内のデータを転置する
function transposeTable(input) {
output = "\n";
// input 内にセル () が残っている間繰り返し(出力の 1 行)
while (pos(input, " | 0) {
output = output + " | ";
beginTr = pos(input, "
をループして最初の をこの行に出力する
while (beginTr > 0) {
beginTd = pos(mid(input, beginTr), " | ") + beginTd - 1;
output = output + mid(input, beginTd, endTd - beginTd + 5);
input = left(input, beginTd - 1) + mid(input, endTd + 5);
// 次の |
を探す。
p = pos(mid(input, beginTr + 1), "
0) {
beginTr = p + beginTr;
} else {
beginTr = 0;
}
}
output = output + "
\n";
}
return output;
}
// 入力文字列中の最初の を転置する
function transpose(input) {
beginTable = pos(input, "");
endTable = pos(input, "
");
if (beginTable == 0 || endTable == 0 || endTable < beginTable) {
return input;
}
return left(input, beginTable + 6)
+ transposeTable(mid(input, beginTable + 7, endTable - beginTable - 7))
+ mid(input, endTable);
}
// カーソルのある列のすべてのセルを転置
for (y = 1; y <= Bottom; y++) {
[x,y] = transpose([x,y]);
}