在JScript中,我已经无可救药地与逃避转义字符混淆了!我想做的就是写一个简单的函数: 函数DoubleUpBackSlash(inputString) { ??????? } 将执行以下操作: <% var inputString =" D:\Internet \ test2.txt" Response.Write(DoubleUpBackSlash( inputString)); %> ...在屏幕上打印出以下内容: D:\\Internet \\ test2.txt 任何人都可以为我填写功能空白吗? TIA, JON Hi, I have been getting hopelessly confused with escaping escape characters in JScript! All I want to do is write a simple funtion: function DoubleUpBackSlash(inputString) { ??????? } which will do the following: <% var inputString = "D:\Internet\test2.txt" Response.Write(DoubleUpBackSlash(inputString)); %> ...printing out the following on the screen: D:\\Internet\\test2.txt Can anyone fill in the blanks in the function for me? TIA, JON嗨雷, 这就是我所追求的(见我在代码中的评论): <% var fso = Server.CreateObject(" Scripting.FileSystemObject"); //无法工作 var wfile = fso.CreateTextFile(" D:\ Inteter \ test2.txt",true); //工作 var wfile = fso.CreateTextFile(" D:\\ \Internet \\test2.txt",true); //希望这个工作! var wfile = fso.CreateTextFile(DoubleUpBackSlash(" D:\Internet \ test2.txt"),true); wfile.WriteLine(" This is a test。 "); wfile.Close(); fso = null; %> 谢谢, JONHi Ray,This is what I''m after (see my comments in the code):<%var fso = Server.CreateObject("Scripting.FileSystemObject");//doesn''t workvar wfile = fso.CreateTextFile("D:\Internet\test2.txt", true);//worksvar wfile = fso.CreateTextFile(" D:\\Internet\\test2.txt", true);//want this to work!var wfile =fso.CreateTextFile(DoubleUpBackSlash("D:\Internet\ test2.txt"), true);wfile.WriteLine("This is a test.");wfile.Close();fso = null;%>Thanks,JON //希望这个工作不会工作JScript的!是否有任何特别的原因,你不想要使用内置的逃生功能 这是必需的?你不能只选择不使用它。如果您分享了 的理由,您可能会对创意解决方案感到惊讶! 雷在工作中 Jon Maz <乔**** @ surfeuNOSPAM.de>在消息中写道 news:Op ************** @ TK2MSFTNGP09.phx.gbl ...The //want this to work won''t work in jscript! Is there any particularreason that you don''t want want to use the built-in escape functionalitythat is required? You can''t just elect to not use it. If you share thereason for your desire, you may be surprised by a creative solution!Ray at work"Jon Maz" <jo****@surfeuNOSPAM.de> wrote in messagenews:Op**************@TK2MSFTNGP09.phx.gbl... Hi Ray, 这就是我所追求的(参见我在代码中的评论): <% var fso = Server.CreateObject(" Scripting.FileSystemObject" ;); //无法工作 var wfile = fso.CreateTextFile(" D:\ Intetert \ test2.txt",true); //工作 var wfile = fso.CreateTextFile(" D:\\Internet \\test2.txt",true); //想要这个工作! var wfile = fso.CreateTextFile(DoubleUpBackSlash(" D:\Internet \ test2.txt"),true); wfile.WriteLine (这是一个测试。; wfile.Close(); fso = null; %> 谢谢, JON Hi Ray, This is what I''m after (see my comments in the code): <% var fso = Server.CreateObject("Scripting.FileSystemObject"); //doesn''t work var wfile = fso.CreateTextFile("D:\Internet\test2.txt", true); //works var wfile = fso.CreateTextFile(" D:\\Internet\\test2.txt", true); //want this to work! var wfile = fso.CreateTextFile(DoubleUpBackSlash("D:\Internet\ test2.txt"), true); wfile.WriteLine("This is a test."); wfile.Close(); fso = null; %> Thanks, JON 这篇关于在JScript中转义转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 18:52