Is there the inverse of the Chr() built-in function?

Is there the inverse of the Chr() built-in function?

  
Hi!
The Chr() built-in function: "The Chr function is a built-in function that returns a single-character string corresponding to the c Ascii character code."
http://www.outsystems.com/help/ServiceStudio/9.0/Language_Reference/Built_in_Functions/Text_functions/Chr_Function.htm

Is there a built-in inverse function that I don't know of? From a character returns the ascii character code.
Hi Tiago,

There's no built in function for that but it should be quite easy to accomplish using c# or java (for example for c# something like int charCode = ((int)ssMyString[0]).

Hope this helps
Guilherme
in C# (.net) i simply use Convert.ToChar(65) and works fine.
Using the database SQL Server (didn't check other databases):
SELECT ASCII( @Char)
---

Hello Tiago,

Depending on the number of times you'll be executing that function, perhaps the query solution generates a significant overhead, as it causes a query to be executed on the database server. I'ts less performant and increases unnecessary load on the database server.

Recommend using one of the other solutions instead.

Cheers
Hello Miguel,
Thank you for your note.
I do know this solution is less performant when compared to the others, but this function will be executed just a few times so it will not cause any impact.

PS: Couldn't this function just be added as a built-in function in the plataform? How hard can that be? :)

Miguel João wrote:
Hello Tiago,

Depending on the number of times you'll be executing that function, perhaps the query solution generates a significant overhead, as it causes a query to be executed on the database server. I'ts less performant and increases unnecessary load on the database server.

Recommend using one of the other solutions instead.

Cheers
 
 
Created an idea:
http://www.outsystems.com/ideas/2115/add-a-built-in-function-which-is-the-inverse-of-chr
Let me just add to this thread that while getting a character from its ASCII code is trivial, predictable and safe, since OutSystems' applications are unicode-ready, getting the ASCII code from a character you don't know beforehand may not be strictly doable because that character may well be out of the ASCII space.

Java and .NET use UTF-16 for string encoding internally and even there you may have characters such as the unicode slice of pizza which need to be decoced into multiple UTF-16 code points.

I believe the main use-case of the Chr function to be the representation of characters such as CR, LF or TAB in a clear and predictable manner, rather than other possible uses such as generating letters.