TyneBridges Member Licensed User Longtime User Jul 18, 2015 #1 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
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
R Roycefer Well-Known Member Licensed User Longtime User Jul 18, 2015 #2 Length() is a member function of the String object. Do Y.Length instead of Length(Y). Upvote 0
klaus Expert Licensed User Longtime User Jul 18, 2015 #3 TyneBridges said: Dim D As String * 2, Click to expand... What is this supposed to do ? Upvote 0
TyneBridges Member Licensed User Longtime User Jul 18, 2015 #4 Create a string 2 characters in length? Upvote 0
TyneBridges Member Licensed User Longtime User Jul 18, 2015 #5 Thanks for the info, Roycefer! Upvote 0
DonManfred Expert Licensed User Longtime User Jul 18, 2015 #6 TyneBridges said: Create a string 2 characters in length? Click to expand... No. A string is a string and can hold as many characters as you want. It is dynamic. Upvote 0
TyneBridges said: Create a string 2 characters in length? Click to expand... No. A string is a string and can hold as many characters as you want. It is dynamic.
R Roycefer Well-Known Member Licensed User Longtime User Jul 18, 2015 #7 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
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.