Translates a string into the current language.

@param   string  $string  The string to translate.
@return  string  The translated string or the key is $script is true
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);
	}
966845
public static function stringToValue($string)
	{
		if($string == '')
		{
			return $string;
		}
		if(is_float($string))
		{
			return (float) $string;
		}
		if(is_int($string))
		{
			return (int) $string;
		}
		if(strtolower($string) == 'true')
		{
			return true;
		}
		if(strtolower($string) == 'false')
		{
			return false;
		}
		if(strtolower($string) == 'null')
		{
			return NULL;
		}
		
		return $string;
	}
793927
private static function applyTransliterations($string)
    {
        // Apply the straight transliterations with strtr as it's much faster
        $string = strtr($string, self::$_transliterations['straight']);

        // Apply the regex rules over the resulting $string
        return preg_replace(
            array_keys(self::$_transliterations['regexp']),
            array_values(self::$_transliterations['regexp']),
            $string
        );
    }
1344241
protected function stringToBoolean($string)
    {
        $string = is_string($string) ? strtolower($string) : $string;

        if (in_array($string, array(true, 1, '1', 'yes', 'true'), true)) {
            return true;
        }

        return false;
    }
1151963
public function translate($string, $params = [], $domain = null)
    {
        $translationDomain = $domain ? $domain : $this->admin->getTranslationDomain();

        return $this->get('translator')->trans($string, $params, $translationDomain);
    }
842607
protected function strlen($string)
    {
        // don't count color codes
        $string = preg_replace("/\33\\[\\d+(;\\d+)?m/", '', $string);

        if (function_exists('mb_strlen')) {
            return mb_strlen($string, 'utf-8');
        }

        return strlen($string);
    }
1222934
public static function strtoupper(string $string): string
    {
        return str_replace('ß', 'SS', mb_strtoupper($string, 'UTF-8'));
    }
431946
public static function up($string): string
    {
        if (self::isMBString()) {
            return mb_strtoupper($string, self::$encoding);
        }

        return strtoupper($string); // @codeCoverageIgnore
    }
203734
public static function trans($string, $replace = [])
    {
        $text = \JText::_($string);

        foreach ($replace as $key => $value) {
            $text = str_replace($key, $value, $text);
        }

        return $text;
    }
535237
public static function strToLower($string)
    {
        $string = str_replace(self::$upperTR, self::$lowerTR, $string);

        return mb_strtolower($string, 'UTF-8');
    }
719838
final public static function handlifyString($string)
    {
        $string = preg_replace('/\W+/', '_', $string);
        $string = preg_replace('/([A-Z])/', '_$1', $string);
        $string = strtolower($string);
        $string = preg_replace('/_+/', '_', trim($string, '_'));

        return $string;
    }
866192
public function convertToNato($string)
    {
        $natoReturn = array();

        for($i=0; $i < strlen($string); $i++) {
            $currentLetter=substr($string,$i,1);

            if (! empty($this->nato[$currentLetter])) {
                $natoLetter = strtolower($this->nato[$currentLetter]);
            } else if (! empty($this->nato[strtolower($currentLetter)])) {
                $natoLetter = strtoupper($this->nato[strtolower($currentLetter)]);
            } else {
                $natoLetter = $currentLetter;
            }
            $natoReturn[] = $natoLetter;
        }

        return implode(" ",$natoReturn);
    }
236724
public function html($string)
    {
        if (!$string) {
            return $string;
        }

        $result = htmlspecialchars($string, $this->htmlSpecialCharsFlags, $this->encoding);
        return $result;
    }
139697
protected function utf8ToCp($string)
    {
        // try iconv first
        if (function_exists('iconv')) {
            $conv = @iconv('UTF-8', 'CP437//IGNORE', $string);
            if($conv) return $conv; // it worked
        }

        // still here? iconv failed to convert the string. Try another method
        // see http://php.net/manual/en/function.iconv.php#108643

        if (function_exists('mb_convert_encoding')) {
            return mb_convert_encoding($string, 'CP850', 'UTF-8');
        } else {
            return $string;
        }
    }
735754
function _convertString($string)
    {
        // chop away beggining and ending quotes
        $string = substr($string, 1, strlen($string) - 2);
        if (strlen($string) > 255) {
            return $this->raiseError("String is too long");
        }

        if ($this->_BIFF_version == 0x0500) {
            return pack("CC", $this->ptg['ptgStr'], strlen($string)).$string;
        } elseif ($this->_BIFF_version == 0x0600) {
            $encoding = 0;   // TODO: Unicode support
            return pack("CCC", $this->ptg['ptgStr'], strlen($string), $encoding).$string;
        }
    }
1071099
private function normalize(string $string): string
    {
        return \str_replace($this->normalizeFrom, $this->normalizeTo, $string);
    }
274003
public function prepare($string)
	{
		if ($this->asciiConversion)
		{
			setlocale(LC_ALL, 'en_us.UTF8');
			$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
		}

		if ($this->aggressive)
		{
			// Convert some characters that 'MAY' be used as alias
			$string = str_replace(array('@', '$', '[dot]', '(dot)'), array('at', 's', '.', '.'), $string);

			// Remove special characters
			$string = preg_replace("/[^a-zA-Z0-9-\.]/", '', $string);

			// Strip multiple dots (.) to one. eg site......com to site.com
			$string = preg_replace("/\.{2,}/", '.', $string);
		}

		$string = trim(strtolower($string));
		$string = str_replace(array("\t", "\r\n", "\r", "\n"), '', $string);

		return $string;
	}