Robert Laic

unread,
Aug 30, 2016, 2:14:04 PM8/30/16
to MIT App Inventor Forum
Hi everyone
There is any way to convert char to ASCII value in App Inventor?
Manny thanks

Italo

unread,
Aug 30, 2016, 2:45:45 PM8/30/16
to MIT App Inventor Forum
This 2 procedures are the equivalent to CHR() and ASC() in other languages.

Download it from here:


Robert Laic

unread,
Aug 30, 2016, 3:07:17 PM8/30/16
to MIT App Inventor Forum
Thank you so much for your answer

Abraham Getzler

unread,
Aug 31, 2016, 1:49:56 PM8/31/16
to MIT App Inventor Forum
(added to the Math section of this FAQ)
ABG

Italo

unread,
Aug 31, 2016, 6:15:49 PM8/31/16
to MIT App Inventor Forum
Thanks Abraham.

Abraham Getzler

unread,
Sep 1, 2016, 2:35:55 PM9/1/16
to MIT App Inventor Forum
@Italo,  There was something nagging me about your blocks.
For a low value like decimal 10 = LF, why do I see something in your text block at that location?
LF usually appears as a blank at best.

Or is this sample meant to work only in a certain range?

ABG

Italo

unread,
Sep 5, 2016, 11:58:00 PM9/5/16
to MIT App Inventor Forum
Abraham, sorry for the late reply.

I just typed <Alt>+1, <Alt>+2, <Alt>+3, etc. on Notepad. And that's what showed.

Like in this chart:


Abraham Getzler

unread,
Sep 6, 2016, 3:26:20 PM9/6/16
to MIT App Inventor Forum
Wow, I haven't seen that code page in decades, since my BASIC days.

I need a nap.

ABG

Pasquale Mariella

unread,
Sep 10, 2016, 2:25:57 PM9/10/16
to MIT App Inventor Forum
Ciao Italo.
Cercavo una soluzione al problema di dover rilevare la coppia di caratteri Cr+Lf ( Chr(13)+Chr(10) ) all'interno di un file di testo.
Ho provato le tue procedure e ho costatato che non funzionano come dovrebbero!
La stringa di caratteri che hai utilizzato non rappresenta affatto i caratteri che mi interessano.
Inoltre, il componente "File" di AI2 quando legge un testo che contiene Cr+Lf come separatore, legge solo il carattele Chr(10) eliminando il Chr(13) !
Hai qualche idea sul come superare questa limitazione?
Se vorrai rispondermi, ti ringrazio in anticipo.

Abraham Getzler

unread,
Sep 10, 2016, 5:54:27 PM9/10/16
to MIT App Inventor Forum
See this Gallery app for sample blocks to do hex conversion using a trick of the Web component.

The two different approaches have not been compared yet to see if they are consistent.

ABG

Italo

unread,
Sep 11, 2016, 1:49:35 AM9/11/16
to MIT App Inventor Forum

Like I posted before, the procedure returns what you see in this table.


You can modify the string and replace any character with the one you need or think should be the right one.

Ghica

unread,
Mar 26, 2017, 6:43:07 AM3/26/17
to MIT App Inventor Forum

Italo,
I checked the length of the string you use to check against, which is 255.
But I would think it needs to be 256?
Cheers, Ghica.

Ghica

unread,
Mar 26, 2017, 7:28:22 AM3/26/17
to mitappinv...@googlegroups.com
Actually, the ASC procedure is OK, but what about the ASCII value 0 as argument to CHAR?
Cheers, Ghica.

Italo

unread,
Mar 26, 2017, 9:48:36 AM3/26/17
to MIT App Inventor Forum
@Ghica : I tried to add that character many times, with different methods, but to no avail. Do you think there's a way to do it? I don't think chr(0) is printable on screen at all, right? This basic procedure relies on the characters that can be represented on screen only. I was thinking, maybe we can make these same procedures, with Javascript in a webviewer, to be able to return chr(0). 

Italo

unread,
Mar 26, 2017, 9:59:19 AM3/26/17
to MIT App Inventor Forum
How about this? Is the null character in app inventor the same as chr(0)? If it is, then this should be OK.




Ghica

unread,
Mar 26, 2017, 5:18:25 PM3/26/17
to MIT App Inventor Forum
That looks much better. I do not know whether the empty character string is the same as chr(0), but in any case this procedure now does not cause runtime errors.
And maybe you should leave the longs string not collapsed. I was experiencing strange loss of blocks after I copied your blocks from the gallery to the backpack and I am wondering whether that could help cause it. No harm, I have been following our advice of frequent saving projects quite well.

Anyway, thanks a lot for these useful procedures!
Cheers, Ghica.
Reply all
Reply to author
Forward
0 new messages