输出在VBScript一个GUID后,它会忽略所有文本 [英] Outputting a GUID in VBScript ignores all text after it

查看:106
本文介绍了输出在VBScript一个GUID后,它会忽略所有文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个经典的ASP应用程序使用GUID,通过使用类型库。然而,即使是一个简单的测试,如写GUID到屏幕给我的问题 - 它打印GUID但忽略一切后(例如HTML标签,附加的话,任何东西)

I'm creating a GUID for use in a Classic ASP application, by using TypeLib. However, even a simple test such as writing the GUID out to the screen is giving me problems - it prints the GUID but ignores everything after it (e.g. HTML tags, additional words, anything).

这里的简陋code测试此:

Here's the rudimentary code to test this:

Set typeLib = Server.CreateObject("Scriptlet.TypeLib")
myGuid = typeLib.Guid
Response.Write myGuid & " is the new GUID"
Set typeLib = Nothing

这将显示类似的 {9DDB27D1-F034-41D7-BB88-D0D811DB91CE} 的,就是这样;的文本的其余部分将被忽略,并且不写出。不过,如果我硬code的GUID值和变量引用它,文本的其余部分将出现就好了。我试着显式转换为字符串值显示之前,但它仍然发生。

This will display something like {9DDB27D1-F034-41D7-BB88-D0D811DB91CE} and that's it; the rest of the text is ignored and isn't written out. However, if I hard-code that GUID value and reference it from a variable, the rest of the text appears just fine. I've tried explicit conversion to a String value before displaying, but it still happens.

推荐答案

我似乎已经解决了我自己的问题..它添加一些额外的文本,所以我不得不这样做:

I seem to have solved my own problem.. it was adding something extra to the text, so I had to do:

myGuid = Left(myGuid, Len(myGuid)-2)

和现在输出的罚款。奇怪的。

and it now outputs fine. Strange.

这篇关于输出在VBScript一个GUID后,它会忽略所有文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆