Android Question Missing function?

TyneBridges

Member
Licensed User
Longtime User
Another very basic one, I'm afraid.

The link https://www.b4x.com/android/help/core.html#string_length says that "length" is a core string function. However, the following will not compile

Dim D As String * 2, M As String * 2, Y As String * 4
Dim StartDt As String, EndDt As String, L As Int
..
Y = EY.Text
..
If D <> "" And M <> "" And Y <> "" Then StartDt = Y & "-" & M & "-" & D
L = Length(Y)

It gives the error "Undeclared variable 'length' was used before it was assigned any value".

It's not a variable - it's meant to be built in...

Any ideas?

Thanks
 

TyneBridges

Member
Licensed User
Longtime User
Create a string 2 characters in length?
 
Upvote 0

TyneBridges

Member
Licensed User
Longtime User
Thanks for the info, Roycefer!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
My pleasure. It also looks like you're trying to manually format a date String. I would recommend against doing that and instead look at the DateTime object and all its member functions. You can set up custom DateTime formats (or use pre-configured ones) and it comes with parsing functions and lots of other helpful stuff. It's much more robust than trying to put together a brittle ad hoc one-time solution.
 
Upvote 0
Top