Passes a string thru an printf.

Note that this method can take a mixed number of arguments as for the sprintf function.

@param   string  $string  The format string.

@return  mixed

@since   1.0
481498
public static function printf($string)
	{
		$lang = static::getLanguage();
		$args = func_get_args();
		$count = count($args);

		if ($count > 0)
		{
			if (is_array($args[$count - 1]))
			{
				$args[0] = $lang->_(
					$string, array_key_exists('jsSafe', $args[$count - 1]) ? $args[$count - 1]['jsSafe'] : false,
					array_key_exists('interpretBackSlashes', $args[$count - 1]) ? $args[$count - 1]['interpretBackSlashes'] : true
				);
			}
			else
			{
				$args[0] = $lang->_($string);
			}

			return call_user_func_array('printf', $args);
		}

		return '';
	}
1003954
protected function escape($string)
    {
        if (preg_match('/["\s,]/', $string) === false) {
            return addslashes($string);
        } else {
            return sprintf('"%s"', addcslashes($string, '"\\'));
        }
    }
75197
public function _($string)
    {
        $this->setTraceLevelOffset(1);

        $result = $this->translate($string);

        $this->setTraceLevelOffset(0);

        return $result;
    }
290083
public function format($string) {
		
		$string = ucwords(str_replace('&', 'and', strtolower($string)));
		
		if( $this->isRemovingSpaces() ) {
			$string	= str_replace(' ', '', $string);
		}
		
		$string	= strtr($string, ' .\'"', '----');
		if( $this->caseProcessing ) {
			if( $this->isCamelCaseProcessing() ) {
				if( $this->caseProcessing == self::LOWERCAMELCASE ) {
					$string = lcfirst($string);
					// } else
					// if( $case == UPPERCAMELCASE ) {
					// $string = ucfirst($string);
				}
			}
		}
		return convertSpecialChars($string);
	}
976643
private function sendString ($string) {
    $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));

    return $bytes_sent;
  }
483704
public function format($string) {
        if ($this->isAnsiEnabled()) {
            return $this->formatAnsi($string);
        }

        return $this->formatPlain($string);
    }
334968
public function translate($string)
    {
        $args = func_get_args();
        $translated = array_shift($args);
        $extraParams = $args;
        if (count($extraParams)>0)
        {
            $translated = vsprintf($translated, $extraParams);
        }

        return $translated;
    }
310008
protected function inflect($string)
    {
        if (null === $this->inflector) {
            return $string;
        }

        return call_user_func($this->inflector, $string);
    }
989743
public function get($string)
    {
        $lowercase = strtolower($string);

        if (!parent::has($lowercase))
        {
            if (isset($this->_aliases[$lowercase])) {
                $key = $this->_aliases[$lowercase];
            }
            else if(!JFactory::getLanguage()->hasKey($string))
            {
                if (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
                    $key = $string;
                } else {
                    //Gets a key from the catalogue and prefixes it
                    $key = $this->getPrefix().$this->generateKey($string);
                }
            }
            else $key = $string;

            $this->set($lowercase, JFactory::getLanguage()->_($key));
        }

        return parent::get($lowercase);
    }
503780
public static function safeStrcpy(string $string): string
    {
        $length = Binary::safeStrlen($string);
        $return = '';
        /** @var int $chunk */
        $chunk = $length >> 1;
        if ($chunk < 1) {
            $chunk = 1;
        }
        for ($i = 0; $i < $length; $i += $chunk) {
            $return .= Binary::safeSubstr($string, $i, $chunk);
        }
        return $return;
    }
1182198
public function stdout($string)
    {
        if (Yii::$app->request->isConsoleRequest) {
            if (Console::streamSupportsAnsiColors(STDOUT)) {
                $args = func_get_args();
                array_shift($args);
                $string = Console::ansiFormat($string, $args);
            }

            Console::stdout($string . "\n");
        }
    }
336504
public function txt($string)
	{
		$args  = func_get_args();
		$count = count($args);

		if ($count > 1)
		{
			if ($count == 2 && is_bool($args[1]))
			{
				return $this->translate($string, $args[1]);
			}

			if ($count == 3 && is_bool($args[1]) && is_bool($args[2]))
			{
				return $this->translate($string, $args[1], $args[2]);
			}

			if (is_array($args[$count - 1]))
			{
				$args[0] = $this->translate(
					$string, array_key_exists('jsSafe', $args[$count - 1]) ? $args[$count - 1]['jsSafe'] : false,
					array_key_exists('interpretBackSlashes', $args[$count - 1]) ? $args[$count - 1]['interpretBackSlashes'] : true
				);
			}
			else
			{
				$args[0] = $this->translate($string);
			}
			$args[0] = preg_replace('/\[\[%([0-9]+):[^\]]*\]\]/', '%\1$s', $args[0]);

			return call_user_func_array('sprintf', $args);
		}

		return $this->translate($string);
	}
989405
protected function parseOptionString($string)
	{
		// Use the first "?" as an alias for the "optional" option
		$string = preg_replace('(^\\?)', ';optional', $string);

		$options = [];
		foreach (preg_split('#;+#', $string, -1, PREG_SPLIT_NO_EMPTY) as $pair)
		{
			$pos = strpos($pair, '=');
			if ($pos === false)
			{
				// Options with no value are set to true, e.g. {FOO;useContent}
				$k = $pair;
				$v = true;
			}
			else
			{
				$k = substr($pair, 0, $pos);
				$v = substr($pair, 1 + $pos);
			}

			$options[$k] = $v;
		}

		return $options;
	}
1305867
public function parse( $string )
	{
		if( !is_string( $string ) )														//  no String given
			throw new InvalidArgumentException( 'Given argument is not a string' );		//  throw Exception

		$this->extendPossibleOptionsWithShortcuts();									//  realize Shortcuts

		$position	= 0;																//  initiate Sign Pointer
		$status		= self::STATUS_START;												//  initiate Status
		$buffer		= "";																//  initiate Argument Buffer
		$option		= "";																//  initiate Option Buffer

		while( isset( $string[$position] ) )											//  loop until End of String
		{
			$sign	= $string[$position];												//  get current Sign
			$position ++;																//  increase Sign Pointer

			switch( $status )															//  handle Sign depending on Status
			{
				case self::STATUS_START:												//  open for all Signs
					$this->onReady( $sign, $status, $buffer, $option );					//  handle Sign
					break;
				case self::STATUS_READ_OPTION_KEY:										//  open for Option Key Signs
					$this->onReadOptionKey( $sign, $status, $buffer, $option );			//  handle Sign
					break;
				case self::STATUS_READ_OPTION_VALUE:									//  open for Option Value Signs
					$this->onReadOptionValue( $sign, $status, $buffer, $option );		//  handle Sign
					break;
				case self::STATUS_READ_ARGUMENT:										//  open for Argument Signs
					$this->onReadArgument( $sign, $status, $buffer );					//  handle Sign
					break;
			}
		}
		$this->onEndOfLine( $status, $buffer, $option );								//  close open States
	}
1168437
public function formatString($string, $format) {

        $fmt = str_replace("_", "%s", $format);
        $str = str_split($string);

        return vsprintf($fmt, $str);
    }
1215061
public function escape($string)
    {
        if (is_string($string)) {
            $func = $this->escape;
            return $func($string);
        }
        return $string;
    }
702343
public static function toBytes ($string)
		{
			$value = null;
			$string = strtoupper($string);

			preg_match('/(\d+)\s?([KMGT]?)/', $string, $match);

			if (isset($match[ 2 ]))
			{
				$digit = (int) $match[ 1 ];
				switch ($match[ 2 ])
				{
					case 'K':
						$value = $digit << 10;
						break;

					case 'M':
						$value = $digit << 20;
						break;

					case 'G':
						$value = $digit << 30;
						break;

					case 'T':
						$value = $digit << 40;
						break;

					default:
						$value = $digit;
						break;
				}
			}

			return $value;
		}