system/Database/BaseConnection.php
public function escapeString($str, bool $like = false)
	{
		if (is_array($str))
		{
			foreach ($str as $key => $val)
			{
				$str[$key] = $this->escapeString($val, $like);
			}

			return $str;
		}

		$str = $this->_escapeString($str);

		// escape LIKE condition wildcards
		if ($like === true)
		{
			return str_replace([
				$this->likeEscapeChar,
				'%',
				'_',
			], [
				$this->likeEscapeChar . $this->likeEscapeChar,
				$this->likeEscapeChar . '%',
				$this->likeEscapeChar . '_',
			], $str
			);
		}

		return $str;
	}
public function escapeString($str, bool $like = false)
	{
		if (is_array($str))
		{
			foreach ($str as $key => $val)
			{
				$str[$key] = $this->escapeString($val, $like);
			}

			return $str;
		}

		$str = $this->_escapeString($str);

		// escape LIKE condition wildcards
		if ($like === true)
		{
			return str_replace([
				$this->likeEscapeChar,
				'%',
				'_',
			], [
				$this->likeEscapeChar . $this->likeEscapeChar,
				$this->likeEscapeChar . '%',
				$this->likeEscapeChar . '_',
			], $str
			);
		}

		return $str;
	}
Escape String

@param  string|string[] $str  Input string
@param  boolean         $like Whether or not the string will be used in a LIKE condition
@return string|string[]