Collections:
INSTR() - Find Substring
How to find a substring in a given string using the INSTR() function?
✍: FYIcenter.com
INSTR(str, substr) is a MySQL built-in function that
locates a substring in a string and replace it with a new string.
For example:
SET @str = 'dba.FYIcenter.com'; SELECT INSTR(@str, 'FYI'); -- +--------------------+ -- | INSTR(@str, 'FYI') | -- +--------------------+ -- | 5 | -- +--------------------+
Reference information of the INSTR() function:
INSTR(str, substr): pos Returns the position of the first occurrence of substring substr in string str. This is the same as the two-argument form of LOCATE(), except that the order of the arguments is reversed. Arguments, return value and availability: str: Required. The string that will be searched in. substr: Required. The substring to search for. pos: Return value. The position where is substring is located. Available since MySQL 4.0.
Related MySQL functions:
⇒ LCASE() - Synonym for LOWER()
⇐ INSERT() - Insert and Replace Substring
2023-11-12, 1366🔥, 0💬
Popular Posts:
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDAT...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...