Wish Smart strings: missing starting/ending $ should trigger a warning

toby

Well-Known Member
Licensed User
Longtime User
B4X:
    Log($"The time is: ${DateTime.Time(DateTime.now)}"$)  'correct one'
    'following two incorrect lines don't cause any error or warning:
    Log("The time is: ${DateTime.Time(DateTime.now)}"$) 'missing the starting $
    Log($"The time is: ${DateTime.Time(DateTime.now)}") 'missing the ending $
 

Mahares

Expert
Licensed User
Longtime User
All these 4 are identical. and correct They yield the same word
B4X:
Log("toby"$$)   'toby
Log("toby"$)    'toby
Log($"toby"$)   'toby
Log($"toby"$$)  'toby

This one yields: string not closed error like the 3rd log line in the 1st post :
B4X:
Log($"toby")
 

toby

Well-Known Member
Licensed User
Longtime User
The problem is that the variables wouldn't be replaced with the value they contain. For example
B4X:
Log("The time is: ${DateTime.Time(DateTime.now)}"$)
'The above line outputs: "The time is: ${DateTime.Time(DateTime.now)
'while "The time is: 12:34:56", or similar, is expected.
 

toby

Well-Known Member
Licensed User
Longtime User
I guess it wouldn't be too hard to implement: For each $", there should be a matching "$, and vice versa.
 

toby

Well-Known Member
Licensed User
Longtime User
To err is human, so I hope the IDE would catch my mistake.
 
Top