@param string  $string
@param integer $limit
@param string  $append

@return string
544367
public static function cutWords(string $string, int $limit = 25, string $append = '...'): string
    {
        preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $string, $matches);
        if (!isset($matches[0]) || mb_strlen($string, 'UTF-8') === mb_strlen($matches[0], 'UTF-8')) {
            return $string;
        }

        return rtrim($matches[0]) . $append;
    }
1171850
public static function char(String $str, Int $limit = 500, String $endChar = '...',  Bool $stripTags = false, String $encoding = "utf-8") : String
    {
        $str = trim($str);

        if( $stripTags === true )
        {
            $str = strip_tags($str);
        }

        $str = preg_replace("/\s+/", ' ', str_replace(["\r\n", "\r", "\n", "&nbsp;"], ' ', $str));

        if( mb_strlen($str, $encoding) <= $limit )
        {
            return $str;
        }
        else
        {
            return mb_substr($str, 0, $limit, $encoding).$endChar;
        }
    }
912062
public final function limit($limit): ?string
    {
        if (is_array($limit)) {
            @ [$limit, $offset] = array_map('abs', $limit);

            return ($offset !== null) ? 'LIMIT '. $limit .' OFFSET '. $offset : 'LIMIT '. $limit;
        }

        if ($limit || $limit === 0 || $limit === '0') {
            return 'LIMIT '. abs($limit);

        }

        return null;
    }
167026
public function append($string)
	{
		ArgumentValidator::validateScalar($string);
		$this->string .= (string)$string;
		return $this;
	}
445215
private function _formatLimit()
    {
        $str = ' LIMIT ';

        if ($this->_skip !== NULL) {
            $str .= $this->_skip;
        }
        if ($this->_skip !== NULL and $this->_limit !== NULL) {
            $str .= ', ';
        }
        if ($this->_limit !== NULL) {
            $str .= $this->_limit;
        }

        return $str;
    }
464080
public function parseLimit($limit)
    {
        $limitStr = '';
        if (!empty($limit)) {
            $limit = explode(',', $limit);
            if (count($limit) > 1) {
                $limitStr = "(numrow>" . $limit[0] . ") AND (numrow<=" . ($limit[0] + $limit[1]) . ")";
            } else {
                $limitStr = "(numrow>0 AND numrow<=" . $limit[0] . ")";
            }

        }
        return $limitStr ? ' WHERE ' . $limitStr : '';
    }
1159210
public function append( $string = "", $sleep = 0 ){
		$this->sameLine( trim( $this->lastLine ) . $string, $sleep );
	}
242995
public function append(string $string) {
        for ($i = 0; $i < \strlen($string); $i++) {
            $this->arrayList->add($string[$i]);
        }
    }
52719
public function getWriteBuffer(int $length, string $append = ''): Promise
    {
        return call([$this, 'getWriteBufferAsync'], $length, $append);
    }
953043
public function setQuerystring(array $str = array(), $append = true, $default = true)
	{
		if ( is_null($this->filterable) ) {
			$this->resetFilterableOptions();	
		}
		if ( sizeof($str) == 0 && $default ) {
			// Default to PHP query string
			parse_str($_SERVER['QUERY_STRING'], $this->filterable['qstring']);
		} else {
			$this->filterable['qstring'] = $str;	
		}
		if ( sizeof($this->filterable['qstring']) > 0 ) {
			if ( !$append ) {
				// Overwrite data
				$this->filterable['filters'] = array();
			}
			foreach ( $this->filterable['qstring'] as $k => $v ) {
				if ( $v == '' ) {
					continue;
				}
				$thisColumn = isset($this->filterable['columns'][$k]) ? $this->filterable['columns'][$k] : false;
				if ( $thisColumn ) {
					// Query string part matches column (or alias)
					$this->filterable['filters'][$thisColumn]['val'] = $v;
					// Evaluate boolean parameter in query string
					$thisBoolData = isset($this->filterable['qstring']['bool'][$k]) ? $this->filterable['qstring']['bool'][$k] : false;
					$thisBoolAvailable = $thisBoolData && isset($this->filterable['bools'][$thisBoolData]) ? $this->filterable['bools'][$thisBoolData] : false;
					if ( $thisBoolData && $thisBoolAvailable ) {
						$this->filterable['filters'][$thisColumn]['boolean'] = $thisBoolAvailable;
					} else {
						$this->filterable['filters'][$thisColumn]['boolean'] = $this->filterable['defaultWhere'];
					}
					// Evaluate operator parameters in the query string
					if ( isset($this->filterable['qstring']['operator'][$k]) && in_array($this->filterable['qstring']['operator'][$k], $this->filterable['operators']) ) {
						$this->filterable['filters'][$thisColumn]['operator'] = $this->filterable['qstring']['operator'][$k];
					} else {
						// Default operator
						$this->filterable['filters'][$thisColumn]['operator'] = $this->filterable['defaultOperator'];
					}
				}
			}
		}
		return $this;
	}
793730
public function getWriteBufferAsync(int $length, string $append = ''): \Generator
    {
        $headers = 'POST '.$this->uri->getPath()." HTTP/1.1\r\nHost: ".$this->uri->getHost().':'.$this->uri->getPort()."\r\n"."Content-Type: application/x-www-form-urlencoded\r\nConnection: keep-alive\r\nKeep-Alive: timeout=100000, max=10000000\r\nContent-Length: ".$length.$this->header."\r\n\r\n";
        $buffer = yield $this->stream->getWriteBuffer(strlen($headers) + $length, $append);
        yield $buffer->bufferWrite($headers);

        return $buffer;
    }
935414
public static function limitWords($string, $limit = 100, $append = '...'): string
    {
        preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $string, $matches);

        if (!Arr::key(0, $matches) || self::len($string) === self::len($matches[0])) {
            return $string;
        }

        return rtrim($matches[0]) . $append;
    }
829465
public function truncate(int $length = 100, string $append = '...') : Manipulator
    {
        return new static(mb_substr($this->string, 0, $length) . $append);
    }
496696
protected function compileLimit(int $limit, int $offset): string
    {
        if (empty($limit) && empty($offset)) {
            return '';
        }

        $statement = '';
        if (!empty($limit)) {
            $statement = "LIMIT {$limit} ";
        }

        if (!empty($offset)) {
            $statement .= "OFFSET {$offset}";
        }

        return trim($statement);
    }
495785
public static function limit(string $value, int $limit = 50, string $end = self::LIMIT_SUFFIX): string
    {
        if (mb_strwidth($value, 'UTF-8') <= $limit) {
            return $value;
        }
        return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')) . $end;
    }
794628
public static function getLimitString($limit)
    {
        if (isset($limit) && !empty($limit)) {
            $limitParts = GeneralUtility::trimExplode(',', $limit);
            if (count($limitParts) === 1) {
                return intval($limitParts[0]);
            }
            if (count($limitParts) === 2) {
                return intval($limitParts[0]) . ',' . intval($limitParts[1]);
            }
        }

        return '';
    }
33434
public static function explode($delimiter, $string, $limit = null) {
        if (empty($string)) return [];
        return explode($delimiter, $string, $limit);
    }