b. How can I get entire blocks of repeated strings out of a variable? The following script is an attempt and I need to split those blocks ("1", "2 2", "3 3 3" and so on).
Code: Select all
// step;
$max = "12";
$sep = " ";
$list = "";
$first= "";
$loop = 1;
WHILE ($loop <= $max) {
// step;
$play = strrepeat("$loop ", $loop);
$first= "$first" . "$play";
$loop++;
}
$input = $first;
$sort = formatlist($input, se, "$sep");
$sort = "$sep" . "$sort" . "$sep";
$sort = trim($sort, " ");
$uni = formatlist($input, sed, "$sep");
foreach ($tk, $uni, $sep) {
///////////////////////////////////////////////
step; // step here so you'll see what's needed
///////////////////////////////////////////////
$cnt = gettoken($sort, count, " $tk ");
$list = "$list" . "$tk = $cnt<crlf>";
}
text "$list";
XYplorer Beta Club