SDU Tools: Invert String in T-SQL

I recently shipped the latest update to my SDU Tools collection.

This time I decided to add a tool that’s in the “cute” category. It’s called InvertString and you can see it action in the image above.

Yes, it takes an input string and returns a string that looks quite like an upside down version of the same string.

As part of the inversion I also reversed the order of the string so when you look at it upside down, it still looks correct. But if what you really want is a mirror image, you could combine it with REVERSE to achieve that outcome:

It’s based on my implementation of USD Encoding that you can find described here:

https://en.wikipedia.org/wiki/Transformation_of_text#Upside-down_text

It supports the English alphabet (sorry other cultures) and a variety of punctuation characters. It can take varchar or nvarchar input but returns nvarchar output so that we have a suitable set of characters to work with.

You can see the tool in action here:

You can find out more about our free SDU Tools here:

http://sdutools.sqldownunder.com

Enjoy !

2 thoughts on “SDU Tools: Invert String in T-SQL”

Leave a Reply

Your email address will not be published.