View Full Version : How can i use (")
Khattat
03-17-2006, 06:35 AM
Hello
How can i use the " in my scripts for eample i want to use " in my message text:rolleyes
thanks;)
rhosk
03-17-2006, 06:44 AM
Preceed it with a slash \"
Intrigued
03-17-2006, 04:13 PM
Or,
'They said, "hello all!", can you believe that?'
Brett
03-17-2006, 04:18 PM
or:
strText = [[And I said, "Hello"!]];
Intrigued
03-17-2006, 04:53 PM
or...
Dialog.Message("", "''Hey you! STOP!''")
Intrigued
03-17-2006, 04:56 PM
or:
strText = [[And I said, "Hello"!]];
Also...
This brings up a "bug"?
The bracks are all colored red, save for one. (second to last one)
That was a bug a ways back wasn't it?
playmenow
03-18-2006, 12:47 AM
yeah, the last one is black...:rolleyes
-- \### represents the ASCII character
strText = "Worm says, \034Hello\034";
Corey
03-18-2006, 05:04 AM
function quoteText(strText)
return (String.Replace(strText, "'", "\"", false));
end
Dialog.Message("A message for you:", quoteText("Corey says 'Hello!'"));
:D
Khattat
03-18-2006, 10:43 PM
Thanks a lot:D :lol :) ;)
Khattat
03-19-2006, 02:36 AM
what caracter can i use instead of "\\" ?
thanks;)
Corey
03-19-2006, 02:40 AM
All showing off aside, the best way to use a quote is to simply escape it with a slash. so anywhere you want a quotation mark in the string just proceed it with a backslash, the backslash will not show up in your string when you use it... :yes
Khattat
03-19-2006, 02:58 AM
oh no but i want to use a file address in the listbox (in ItemData) for example i get the address with the Dialog.FileBrowse and save the address in a LUA file for example i get this address :
C:\Track1.mp3
but this address is showed in ams:
C:Track1.mp3
what can i do for this?
goukilord10
03-19-2006, 01:11 PM
C:\\Track1.mp3
aplly for all subdirectories
like
C:\\my folder\\my folder 2\\my file.bin
oh no but i want to use a file address in the listbox (in ItemData) for example i get the address with the Dialog.FileBrowse and save the address in a LUA file for example i get this address :
C:\Track1.mp3
but this address is showed in ams:
C:Track1.mp3
what can i do for this?
One thing you could do is use the String.SplitPath action to separate the path returned by your Dialog.FileBrowse() into it's components and then include the extra "\" in a concat before display to the user.
Something like this:
-- Collect the list of files from the user
t_ReturnedFiles = {};
t_ReturnedFiles = Dialog.FileBrowse(true, "Open File", _ProgramFilesFolder, "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);
-- Step through the list of returned files splitting each into its path parts
-- i.e. "C:\My Document\pic.jpg" --> "C:\", "My Documents\", "pic.jpg"
for index_ReturnedFiles, string_ReturnedFiles in t_Files do
t_PathParts = {};
t_PathParts = String.SplitPath(string_ReturnedFiles);
-- Now reassemble the separate parts adding the extra slashes
-- i.e. "C:\\My Documents\\pic.jpg\" (AMS should ignore the last slash)
for index_PathParts, string_PathParts in t_PathParts do
string_ReturnedFiles = "";
String.Concat(string_ReturnedFiles, string_PathParts.."\");
end
end
-- This should leave you with a t_ReturnedFiles table that contains
-- file path strings with doubled slashes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.