#45449 - 2003-09-16 01:49 PM
Bug or Feature
|
creutz
Fresh Scripter
Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
|
[Moderator (Sealeopard): Moved topic from 'Scripts' to 'Starters' forum due to lack of script in body]
$X = "qwery"
? '$X' gives qwerty ? '$X_' gives $X_ ? '$X'+'_' gives qwerty_
why does the second example not print the variables content
tia Creutz
ps more of a question, not a problem anymore as I solved the situation as in example 3 [ 17. September 2003, 20:43: Message edited by: sealeopard ]
|
|
Top
|
|
|
|
#45450 - 2003-09-16 02:01 PM
Re: Bug or Feature
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Try: $x='qwerty' $z='12345'
? '$x$z'
The issue is the way that KiXtart parses the string and interpolates variable names within the string.
In your example $X_ is interpreted as the name of the variable which is currently empty. When the variable is empty the text of the veriable name is printed as text.
A best practice is to not include variable names within strings. [ 16. September 2003, 14:35: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#45452 - 2003-09-16 02:23 PM
Re: Bug or Feature
|
creutz
Fresh Scripter
Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
|
actually I did $X='qwerty' and ? '$X_' did not work but ? '$X.' works, I get qwerty.
it is only the underscore just after a variable that does not work - strange is it not
Creutz
ps I will try to use concatenation better in the future
|
|
Top
|
|
|
|
#45454 - 2003-09-16 02:29 PM
Re: Bug or Feature
|
creutz
Fresh Scripter
Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
|
Please explain to me, why a underscore after a variable is NO NO but an other charater like space or period OK, I dont see the consistency.
Is underscore some special character that I dont know of?
? Creutz [ 16. September 2003, 14:30: Message edited by: creutz ]
|
|
Top
|
|
|
|
#45455 - 2003-09-16 02:38 PM
Re: Bug or Feature
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I already explained it.
The underscore is not a special function character like space or period and is interpretted as part of the variable name. Why is that difficult to comprehend?
|
|
Top
|
|
|
|
#45458 - 2003-09-16 02:44 PM
Re: Bug or Feature
|
creutz
Fresh Scripter
Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
|
at last I got
underscore is as much a character as a, b, c, ... but space, period and such are separators
thanks for the explains
Creutz
|
|
Top
|
|
|
|
#45461 - 2003-09-17 02:56 AM
Re: Bug or Feature
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The term 'special characters' actually may be a little "strong". when parsing a string that may contain variables, some character just aren't considered to be part of a variable name. Like the "$" which is the start of a variable and not a character anywhere else in the variable name. So in this case, is "$" a special character? I do not think it really matters especially if one starts to follow the "no vars in strings" best practice. [ 17. September 2003, 02:59: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 507 anonymous users online.
|
|
|