本文整理汇总了PHP中QString::split方法的典型用法代码示例。如果您正苦于以下问题:PHP QString::split方法的具体用法?PHP QString::split怎么用?PHP QString::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupModelData
private function setupModelData(QStringList $lines, TreeItem $parent)
{
$parents = array();
$indentations = array();
array_push($parents, $parent);
array_push($indentations, 0);
$number = 0;
while ($number < $lines->count()) {
$position = 0;
while ($position < $lines[$number]->length()) {
if ($lines[$number]->mid($position, 1) != " ") {
break;
}
$position++;
}
$lineData = new QString($lines[$number]->mid($position)->trimmed());
if (!$lineData->isEmpty()) {
// Read the column data from the rest of the line.
$columnStrings = $lineData->split("\t", QString::SkipEmptyParts);
$columnData = array();
for ($column = 0; $column < $columnStrings->count(); ++$column) {
array_push($columnData, $columnStrings[$column]);
}
if ($position > $indentations[count($indentations)]) {
// The last child of the current parent is now the new parent
// unless the current parent has no children.
if ($parents[count($parents)]->childCount() > 0) {
array_push($parent, $parents[count($parents)]->child($parents[count($parents)]->childCount() - 1));
array_push($indentations, $position);
}
} else {
while ($position < $indentations[count($indentations)] && count($parents) > 0) {
array_pop($parents);
array_pop($indentations);
}
}
// Append a new item to the current parent's list of children.
$parents[count($parents)]->appendChild(new TreeItem($columnData, $parents[count($parents)]));
}
$number++;
}
}