如何通过特殊字符st功能 [英] how to pass special charchters sting to function

查看:103
本文介绍了如何通过特殊字符st功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我正在编写一个函数,需要将以下字符串作为参数传递.

但是我不能,因为如果我将此值设置为vaiable,那么varible将显示空值.
字符串如下.

"测试 


昏暗的strpev
   strpev ="测试 



上面的代码的输出为空,为什么?
还有其他方法可以将此值设置为变量吗?所以我可以将此变量传递给asp函数.

解决方案

检查名称->您将strpev和strprv混在一起

将OPTION EXPLICIT放在每个代码文件的第一行,以确保在执行时选中此选项.

祝您好运!


输出不为null,如果您查看来源,则会看到< test> ;,它不会显示在浏览器上.显示<" & >",则需要使用& lt;和& gt; (在&和lt/gt之间替换空格),如下所示:

 strprv = "  


HTML对其进行编码以按原样使用,否则将其视为标签.
试试:

  Dim  strpev  As  字符串
strpev = "  


hello friend,

i am writing a function where i need to pass the below string as parameter.

but i can''t because if i set this value to vaiable then varible shows null value.
string is as below.

"<test>"


 dim strpev
   strpev="<test>"

response.write strprv



above code''s output is null why?
is there any other way to set this value to variable? so i can pass this variable to asp funtion..

thanks in advance..

解决方案

Check the name -> You mixup strpev and strprv

Put OPTION EXPLICIT as first line in every code file to make sure this is checked on execution.

Good luck!


The output is not null, if you view the souce, you will see <test>, which is not displayed on the browser. To show "<" & ">", you need to use & lt; and & gt; (replace space between & and lt/gt) the folllowing:

strprv ="<test>"


HTML Encode it to use it as is, or else it is considered a tag.
Try:

Dim strpev As String
strpev = "<test>"


这篇关于如何通过特殊字符st功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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