Guys, Wolfgang,
just found "the" thing about interpolated strings, and thought maybe i'm not the only one a bit slow
VAR i:= 4 AS INT
VAR c AS STRING
c:= i"Bla {i} blabla"
i.e.: the syntax allows to insert ANY type into a string, handling silently the conversions! That's really cool.
Even something like
c:= i"Bla {oMainWindow} blabla"
works, inserting the classname.
So you might consider adding/adapting the docs, as up2now the samples insert only strings, which is relatively pointless
Karl
Interpolated Strings
Interpolated Strings
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Interpolated Strings
Hi Karl,
Currently I am on holiday, will add better samples after my return.
Wolfgang
Currently I am on holiday, will add better samples after my return.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Interpolated Strings
Ey, saw your "status" in whatsapp - cool location....
Enjoy your free days, i'm almost at the end of mine <sigh>
Karl
Enjoy your free days, i'm almost at the end of mine <sigh>
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
Interpolated Strings
Hi Karl,
I'm eagerly waiting for the next C# feature to become true.
local dw as dword
dw := 12_123_789
instead of the boring
dw := 12123789
regards
Karl-Heinz
I'm eagerly waiting for the next C# feature to become true.
local dw as dword
dw := 12_123_789
instead of the boring
dw := 12123789
regards
Karl-Heinz
Interpolated Strings
I like that a lot, too!
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Interpolated Strings
Could it be that you didn't get the drift of my post?
All samples i saw for i"..." used strings as insertion, and that is really old, as i can do the same with simple +...+, so i never understood the usecase
But for any other type it comes handy...
K.
All samples i saw for i"..." used strings as insertion, and that is really old, as i can do the same with simple +...+, so i never understood the usecase
But for any other type it comes handy...
K.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
Interpolated Strings
? 12.22 + " " + today() + " " + setcentury() + " " + 12123789
Maybe even that will work someday
? 12.22 + " " + today() + " " + setcentury() + " " + 12_123_789
Maybe even that will work someday
? 12.22 + " " + today() + " " + setcentury() + " " + 12_123_789
Interpolated Strings
That all works (but only) for "?"...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Interpolated Strings
Mmm, that (underscore delimiters inside numeric literals) should not be too difficult to implement I think.
I'll see what I can do.
Robert
I'll see what I can do.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 50
- Joined: Fri Feb 16, 2018 7:52 am
Interpolated Strings
I use this a lot. I have an old C# application built around datasets and i use this when building sql strings.
plInfo.SqlUpdate =
$@"UPDATE {Const.TBL_PRICE_LIST_STRUCT}
SET
{Const.COL_COLUMN_NUM} = {dataReader.SqlValueString(Const.COL_COLUMN_NUM)}
,{Const.COL_START_POSITION} = {dataReader.SqlValueString(Const.COL_START_POSITION)}
,{Const.COL_END_POSITION} = {dataReader.SqlValueString(Const.COL_END_POSITION)}
,{Const.COL_IS_ACTIVE} = {dataReader.SqlValueString(Const.COL_IS_ACTIVE)}
,{Const.COL_IMPORT_FORMAT} = {dataReader.SqlValueString(Const.COL_IMPORT_FORMAT)}
,{Const.COL_EDIT_UID} = {dataReader.SqlValueString(Const.COL_EDIT_UID)}
,{Const.COL_EDIT_DATE} = '{YYYYMMDDHHMMSS}'
,{Const.COL_CREATE_UID} = {dataReader.SqlValueString(Const.COL_CREATE_UID)}
,{Const.COL_CREATE_DATE} = {dataReader.SqlValueString(Const.COL_CREATE_DATE)}
,{Const.COL_PRICE_FORMAT_NUM} = {dataReader.SqlValueString(Const.COL_PRICE_FORMAT_NUM)}
WHERE {Const.COL_PLS_NUM} = {dataReader.SqlValueString(Const.COL_PLS_NUM)}";
plInfo.SqlUpdate =
$@"UPDATE {Const.TBL_PRICE_LIST_STRUCT}
SET
{Const.COL_COLUMN_NUM} = {dataReader.SqlValueString(Const.COL_COLUMN_NUM)}
,{Const.COL_START_POSITION} = {dataReader.SqlValueString(Const.COL_START_POSITION)}
,{Const.COL_END_POSITION} = {dataReader.SqlValueString(Const.COL_END_POSITION)}
,{Const.COL_IS_ACTIVE} = {dataReader.SqlValueString(Const.COL_IS_ACTIVE)}
,{Const.COL_IMPORT_FORMAT} = {dataReader.SqlValueString(Const.COL_IMPORT_FORMAT)}
,{Const.COL_EDIT_UID} = {dataReader.SqlValueString(Const.COL_EDIT_UID)}
,{Const.COL_EDIT_DATE} = '{YYYYMMDDHHMMSS}'
,{Const.COL_CREATE_UID} = {dataReader.SqlValueString(Const.COL_CREATE_UID)}
,{Const.COL_CREATE_DATE} = {dataReader.SqlValueString(Const.COL_CREATE_DATE)}
,{Const.COL_PRICE_FORMAT_NUM} = {dataReader.SqlValueString(Const.COL_PRICE_FORMAT_NUM)}
WHERE {Const.COL_PLS_NUM} = {dataReader.SqlValueString(Const.COL_PLS_NUM)}";