![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Handling the backslash in a string concatenation Topic Summary: Created On: 25-Jul-2008 18:59 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Hi David, Thank you for your prompt and helpful response to my post. I didn't realize the script could actually read the file path in its non-DXL form and automatically interpret it correctly. It saves me a lot of work. Thank you for your help. Regards, Pranav | |
![]() |
|
Hi All,
I have a quick question. I am writing a script that reads the file path of an export location from a module attribute in a formal module. The default location for the csv export for this module is captured in this module attribute. In DXL, a file path has the following format: C:\\data\\Metrics but since our requirements engineers do not know this, it likely that they will store the following in the module attribute. c:\data\Metrics I have written a DXL function to convert the path above to correct path that is recognizable in DXL. I have attached the code to this post. I keep getting errors indicating "badly formed tokens". If you have any ideas/suggestions as to how I might circumvent this issue, please do let me know. Thank you. Regards, Pranav |
|
![]() |
|
![]() |
|
In your DXL, you have to escape a backslash with a backslash.
So... "D:\Test Project\sampleexport.CSV" becomes "D:\\Test Project\\sampleexport.CSV" if(temp == "\") becomes if(temp == "\\") Be aware that esaping backslashes is only necessary in your DXL script. If you "get" the string directly from the attribute and assign it directly to a string variable, escaping is not necessary. Escaping of backslahses is only necessary in the hard-coded strings in your DXL script. See the attached modified code. See print "Test 1" and "Test 2" at the bottom. Both print the same result. You'll see that print "Test 1" already strips out the double-backslashes. |
|
![]() |
|
![]() |
|
Hi David,
Thank you for your prompt and helpful response to my post. I didn't realize the script could actually read the file path in its non-DXL form and automatically interpret it correctly. It saves me a lot of work. Thank you for your help. Regards, Pranav |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.