Search code examples
crystal-reports

Crystal Syntax Propercase except acronymns


I'd like to use the Crystal Syntax in a formula to populate data from a database into Propercase like:

propercase(string)

That would turn data in a column from LOREM IPSUM to Lorem Ipsum

However, I don't want that to happen with acronyms. Let's say I have just one acronym used, that I'd like to keep in Uppercase. Is there anyway to add a case statement to the formatting so that the specified acronym doesn't change.

For example: LOREM IMPSUM(ABC) should become Lorem Ipsum(ABC) NOT Lorem Ipsum(Abc).

Would that type of formatting work in a Case Statement?


Solution

  • You can use the Replace-function to change the acronyms back to uppercase after using the Propercase-function on the string:

    Replace(Propercase("LOREM IMPSUM(ABC)"), "Abc", "ABC")
    

    Note: If there's a word like Abcdefg, the result will be ABCdefg.