CString to Text?

dim c as CString = “Hello”
dim t as text = c

such a line causes an error as it can’t be converted, so how do we do that?
I didn’t see a function to convert from CString to Text with given encoding.

There is a shared method on Text for that:

Text.FromCString(str As CString, encoding as TextEncoding) As Text

… but its scope is Protected. Just looked it up in the iOS docs and it says:

Not yet available.

Maybe you could do it via a String ( CString -> String, then String -> Text ) for the time being?

yes, that seems to work:

dim c as cstring = "Hello" dim t as text = text.FromCString(c, TextEncoding.UTF8) Break

it must be protected, else you could call it anywhere…

Yes, you are right, Text is not a Class as I thought. I think the term “shared method” for FromCString is misleading, it is just a method of a Module.