Re: [Vala] ascii



On Tue, 2011-10-25 at 11:32 -0400, "Luis L. Rodríguez Oro" wrote:
El 25/10/11 11:24, Xavier Bestel escribió:
On Tue, 2011-10-25 at 11:19 -0400, "Luis L. Rodríguez Oro" wrote:
El 25/10/11 08:52, Rodrigo Esteban Cares Guarda escribió:
Hi,
You can try:

int ascii_value = int.parse("%d".printf('X'));

Replacing X char by your character.

Good luck.

El mar, 25-10-2011 a las 08:10 -0400, "Luis L. Rodríguez Oro" escribió:
How can i get ascii code from a character?


thank you very much, work perfect!
I hope it's not the Vala Recommended Way. It looks awful.

      Xav

looks awful, but Rodrigo was very kind to share this solution. maybe you 
can share the correct way.

Here you are, if I understood you correctly:
        unichar c = 'é';
        int v = (int)c;
        stdout.printf("é = U+%04X\n", v);

HTH,
        Xav




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]