Page 1 of 1
Date Variables: How to escape the "." (DOT not supported?)
Posted: 21 Jul 2014 08:10
by Filehero
Hi,
I want to output a simple formatted date, however the "." seemingly isn't supported (line #2).
Code: Select all
$date_ok = <date dd-mm-yyyy>;
$date_broken = <date dd.mm.yyyy>; // ???????? or is it a Bug?
$date_stillbroken = eval(<date dd.mm.yyyy>);
$DOT = ".";
$date_fun = <date dd$DOTmm$DOTyyyy>; // funny
msg($date_ok<br>$date_broken<br>$date_stillbroken<br>$date_fun);
Do I need to escape it somehow, or is it rather a bug?
/e: replaced
datem by the correct
date
Cheers,
Filehero
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 10:43
by admin
You have to quote it, else the "." are processed as concatenators.
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 10:53
by Filehero
Moin,
admin wrote:You have to quote it, else the "." are processed as concatenators.
thanks. The outer quotes I hadn't tried - only all sorts of quoting/masking including the dots inside, arghh.
Maybe you can just add this tip to manual.
/e: fixed typo
Cheers,
Filehero
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 11:22
by admin
Well, you should quote all literal strings. Unquoted strings are only tolerated but not recommended.
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 15:34
by Filehero
admin wrote:Well, you should quote all literal strings.
I do, but for whatever reason I thought I haven't to do that for XY's built-in variables.
cheers,
Filehero
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 16:08
by admin
Well, I make the same mistake once in a while. That's because it mostly works, but it does not work when there are dots in it.
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 16:24
by Filehero
admin wrote:Well, I make the same mistake once in a while. That's because it mostly works, but it does not work when there are dots in it.
Good to know it's a boss-error.
Maybe adding a little hint to the quote section my reduce the number even more, such as
Note, this rule also applies when using all kind of XY-provided variables (<linked to variables section>), e.g. msg("<date dd.mm.yyyy>") or echo("%personal%").
Cheers,
Filehero
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 21 Jul 2014 23:20
by PeterH
I don't think this is consistent
For me these are (XY-)variables - and it would be strange if they must be quoted.
But OK: assume they are not variables - and write them with single quotes
Sorry: it don't feels right this way

Re: Date Variables: How to escape the "." (DOT not supported
Posted: 22 Jul 2014 14:36
by admin
PeterH wrote:For me these are (XY-)variables - and it would be strange if they must be quoted.
Agreed, next version will improve it.
Re: Date Variables: How to escape the "." (DOT not supported
Posted: 22 Jul 2014 22:14
by PeterH
admin wrote:PeterH wrote:For me these are (XY-)variables - and it would be strange if they must be quoted.
Agreed, next version will improve it.
If I understand it correct <...> variables are now handled same as $... variables. I think just logical.
This should also be documented: they can be used unquoted and in double quotes.