How to get the ASCII value of a character?

In Xojo for Desktop, we can call something like this:

dim i as integer=asc("h") // i will = 104

How do we get the ASCII value of a character in iOS? I’ve been trying this for about 45 minutes and it’s driving me a little crazy…

Thanks!

It looks like the Codepoints method is what’s needed, but the example in the docs gives no clue how to actually use it…

There’s no ASC since all text is unicode savvy (usually represented as utf-8)
So you get the “code point” which is sort of analogous to ASC
And yes its more verbose - for the time being - this may change

dim myText as text = "a" // create the string dim i as integer For Each codePoint As UInt32 In myText.Codepoints // this will be an iterator that only has one character to iterate over i = codePoint Next

This is kind of off the top of my head so there may well be something shorter

Thank you Norman, that worked perfectly.

Now if I could figure out how to make a popup menu/selector control, I’d be all set and ready to purchase the Xojo build license.

Back to the documentation!

[quote=176257:@C Mana]Thank you Norman, that worked perfectly.

Now if I could figure out how to make a popup menu/selector control, I’d be all set and ready to purchase the Xojo build license.

Back to the documentation![/quote]

In iOS there is no PopupMenu. You can use the iOSTable instead, or the UIPicker from iOSKit. See https://github.com/Mitchboo/XojoiOSWrapper/tree/master for the link, and where you can also download the XojoiOSWrapper where you will find several “old” commands such as ASC.

The UIPicker in iOSKit is called pickerView and is in the extensions module. There is an example of it’s use in iOSKit on the MissingControlsView. It works fine in 2015r1 but has a small issue in the next Xojo version which I will push an update to fix tomorrow afternoon (although that won’t effect you.)