Skip to content
Advertisement

Reverse order of every other character in a string

I’m currently working on a project where the data I’m receiving is being given to me in a messed up order. I need every 2 characters to switch places in a string. Currently I have the below code, but it is ungodly slow in a function or stored procedure. Any help would be appreciated.

Ex: FK741 OCEV needs to be KF47 1COVE

Advertisement

Answer

You can do that as

Returns:

Online Demo

If you have more than one string then

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement