Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / reading the string

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 11th Dec 2011 16:50
if i read the string from file in this case ini file, and the string is "models/model.x" with quotes and i want to load that file name how can i remove quotes and then use that string with load object command?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 17:26
Try this:

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 11th Dec 2011 20:50
ok i tested your code and it works, it removes quotes, but when i tried to use it in my project it returns empty string and load object fails. is there a way to find quotes and remove them some other way?
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 11th Dec 2011 21:28
Also if you have Matrix1 utilities; use this function: UNQUOTE$ ( Source String )

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 22:22
Quote: "is there a way to find quotes and remove them some other way? "


If my method fails as you describe then other methods will probably fail too such as the one just suggested. Have you tried printing out the string before doing anything with it? Perhaps it's not what you expect?

And how did you give the string a value? Perhaps we need to see sample code and media?
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 22:43
Just tagging on...

However my curiosity is how is the string placed in the ini file and also what method are you using to extract the code?

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Dec 2011 00:10
An empty string you say? If GG's example works for you, but doesn't work in your project when you implement it, I can only conclude that the variable you store the string in isn't global. It would help if you posted the section of your code that does the reading, and the section of the code that does the loading for further examination. If they are in functions or subroutines, post the entire function/subroutine.

TheComet

Login to post a reply

Server time is: 2026-07-09 15:47:12
Your offset time is: 2026-07-09 15:47:12