Delphi: Convert set of Char to string WITH ranges

In an application I’m working on, I need to convert a set of characters to a string, but I want it to be short, so I want to keep the ranges intact. Now, there may be a better way of doing this, but I had little luck finding a solution online, so I wrote this piece of code:

If you input [‘a’..’z’, ‘A’..’Z’, ‘0’..’9′, ‘_’, ‘ ‘, ‘.’], it will print out the string: [‘ ‘, ‘.’, ‘0’..’9′, ‘A’..’Z’, ‘_’, ‘a’..’z’]

In case anyone knows a better way of doing this, let me know in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.