Cuts off unneeded part of a string (`getString()` indexing remains
unchanged).
@param int $pos cutting position
@param int $minDiff minimum difference from the last cut for the cut to
be performed (cutting to frequent degrades performance)
@return void
773818
public function cut(int $pos, int $minDiff = 1000): void {
        if ($pos >= $this->offset + $minDiff) {
            $this->buffer = mb_substr($this->buffer, $pos - $this->offset);
            $this->offset = $pos;
        }
    }
530965
public function seekto($pos)
    {
        $this->pos = ($this->strlen < $pos) ? $this->strlen : $pos;

        return $this->pos;
    }
1030020
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getPersonId();
                break;
            case 2:
                return $this->getFunctionId();
                break;
            case 3:
                return $this->getCreatedAt();
                break;
            case 4:
                return $this->getUpdatedAt();
                break;
            case 5:
                return $this->getVersion();
                break;
            case 6:
                return $this->getVersionCreatedAt();
                break;
            case 7:
                return $this->getVersionCreatedBy();
                break;
            case 8:
                return $this->getPersonIdVersion();
                break;
            case 9:
                return $this->getFunctionIdVersion();
                break;
            default:
                return null;
                break;
        } // switch()
    }
647320
public static function isdigitat($str, $pos)
    {
        if ($pos >= strlen($str))
            return false;

        return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
    }
1102458
public function parseLinkDestination($str, $pos, $max)
    {
        $lines = 0;
        $start = $pos;
        $result = new \stdClass();
        $result->ok = false;
        $result->pos = 0;
        $result->lines = 0;
        $result->str = '';

        if( $pos === $max ) return $result;

        if ($str[$pos] === '<') {
            $pos++;
            while ($pos < $max) {
                $ch= $str[$pos];
                if ($str[$pos] == "\n" || $this->utils->isSpace($ch)) { return $result; }
                if ($ch === '>') {
                    $result->pos = $pos + 1;
                    $result->str = $this->utils->unescapeAll(substr($str, $start + 1, $pos-($start+1)));
                    $result->ok = true;
                    return $result;
                }
                if ($ch === '\\' && $pos + 1 < $max) {
                    $pos += 2;
                    continue;
                }

                $pos++;
            }

            // no closing '>'
            return $result;
        }

        // this should be ... } else { ... branch

        $level = 0;
        while ($pos < $max) {
            $ch = $str[$pos];

            if ($ch === ' ') { break; }

            // ascii control characters
            $code = ord($ch);
            if ($code < 0x20 || $code === 0x7F) { break; }

            if ($ch === '\\' && $pos + 1 < $max) {
                $pos += 2;
                continue;
            }

            if ($ch === '(' ) {
                $level++;
            }

            if ($ch === ')' ) {
                if ($level === 0) { break; }
                $level--;
            }

            $pos++;
        }

        if ($start === $pos) { return $result; }
        if ($level !== 0) { return $result; }

        $result->str = $this->utils->unescapeAll(substr($str, $start, $pos-$start));
        $result->lines = $lines;
        $result->pos = $pos;
        $result->ok = true;
        return $result;
    }
346695
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getCode();
                break;
            case 2:
                return $this->getDriverCode();
                break;
            case 3:
                return $this->getTitle();
                break;
            case 4:
                return $this->getSerializedConfiguration();
                break;
            default:
                return;
                break;
        } // switch()
    }
42787
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getName();
                break;
            case 2:
                return $this->getRole();
                break;
            default:
                return null;
                break;
        } // switch()
    }
67949
public function mapPos($pos){
       
        foreach ($this->snippets as $k => $v){
            $pos += $k;
            if($pos < $k + strlen($v)){
                break;
            }
            $pos -= ($k + strlen($v));
            
        }
        return $pos;
    }
715246
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getSenderlogin();
                break;
            case 2:
                return $this->getReceiverlogin();
                break;
            case 3:
                return $this->getTransactionid();
                break;
            case 4:
                return $this->getBillid();
                break;
            case 5:
                return $this->getAmount();
                break;
            case 6:
                return $this->getMessage();
                break;
            case 7:
                return $this->getStatus();
                break;
            case 8:
                return $this->getDatetime();
                break;
            default:
                return null;
                break;
        } // switch()
    }
1179796
protected static String getPartialEndedWord(String str, int pos){
		assert(pos < str.length() && pos >= 0);

		if(	posIsAtWord(str, pos) ){
			int prevSpace = findLastNonLetterOrDigit(str, pos);

			return str.substring(prevSpace+1, pos+1);
		}
		return null;
	}
318346
public function setPosition( $pos )
	{
		if ( $pos == $this->getPosition() ) { return; }

		$this->_values['pos'] = (int) $pos;
		$this->setModified();
	}
1059330
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getName();
                break;
            case 2:
                return $this->getStreet();
                break;
            case 3:
                return $this->getZip();
                break;
            case 4:
                return $this->getCity();
                break;
            case 5:
                return $this->getCountryId();
                break;
            case 6:
                return $this->getPhone();
                break;
            case 7:
                return $this->getFax();
                break;
            case 8:
                return $this->getEmail();
                break;
            case 9:
                return $this->getLegalform();
                break;
            case 10:
                return $this->getLogo();
                break;
            case 11:
                return $this->getCreated();
                break;
            case 12:
                return $this->getNotes();
                break;
            default:
                return null;
                break;
        } // switch()
    }
703733
static function recuperer_argument_balise($pos, $p) {
		if (!isset($p->param[0])) {
			return null;
		}
		if (!isset($p->param[0][$pos])) {
			return null;
		}
		return $p->param[0][$pos];
	}
27688
public static function cut(string $str, int $length, string $cut_msg = null) : string
    {
        if (isset($cut_msg)) $msg = $cut_msg; else $msg = '...';
        return function_exists('mb_substr') ? mb_substr($str, 0, $length, 'utf-8') . $msg : substr($str, 0, $length) . $msg;
    }
1078225
public static String 
    trim( String string, int pos ) 
    {
        int len = string.length();

     	int leftPos = pos;
     	int rightPos = len;
     	
    	for( ; rightPos > 0; --rightPos ) 
    	{
    	    char ch = string.charAt( rightPos - 1 );
    		if( ch != ' '
    		    && ch != '\t' 
    		    && ch != '\n' 
    		    && ch != '\r' ) 
    		{    			
    			break;
    		}
    	}
    	
    	for( ; leftPos < rightPos; ++leftPos )
    	{
    	    char ch = string.charAt( leftPos ); 
    		if( ch != ' ' 
    		    && ch != '\t' 
    		    && ch != '\n' 
    		    && ch != '\r' ) 
    		{    			
    			break;
    		}
    	}
    	
    	if( rightPos <= leftPos ) 
    	{
    		return "";
    	}
    	
    	return ( leftPos == 0 && rightPos == string.length() )? string : 
    	                                                        string.substring( leftPos, rightPos );
    }
460671
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setCode($value);
                break;
            case 2:
                $this->setEn($value);
                break;
            case 3:
                $this->setDe($value);
                break;
        } // switch()
    }
1110871
public function getValueForPosition($pos) {
        return (isset($this->cells[$pos])) ? $this->cells[$pos]->getValue(): null;
    }