XHanch Studio Log in | Register | Cart

Forum

[How to] Replacing ...
 
Notifications
Clear all

[How to] Replacing string with MySQL replace function

1 Posts
1 Users
0 Likes
1,553 Views
XHanch
(@xhanch-alt)
Posts: 2105
Member Admin
Topic starter
 

MySQL provides a built-in function to replace a string or part of it.

Syntax:

repalce(str, from_str, to_str)

The MySQL replace() function will return the string str with all occurrences of the string from_str replaced by the string to_str.
The replace() performs a case-sensitive match when searching for from_str.

Example:

select replace('something', 'o', 'a');
> Will return 'samething'
 
Posted : 12/05/2011 2:42 pm
Share:

× Close Menu