撇号混淆 [英] apostrophe confusion

查看:98
本文介绍了撇号混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ray最近回答了我关于撇号替换的问题,建议

关于如何使用2个函数来表达他给我一些代码,称为SafeIn和

Safeout


我很难看到差异。事实上,结果是

相同。


这是我的旧代码:


替换(Trim(Request.Form(" InternalDesc"))),"''",'''''")

这是Ray建​​议的:

SafeIn(Request.Form(InternalDesc))




函数SafeIn(theString)

SafeIn =替换(theString,"''","''''")

结束函数

结果相同:当我输入时:

不会


一个显示它的页面,它看起来像:

won'''t

Ray recently answered my question about apostrophe replacement with advice
on how to use 2 functions for hwich he gave me some code, called SafeIn and
Safeout

I''m having a hard time seeing the difference. In fact, the results are the
same.

Here''s my old code:

Replace(Trim(Request.Form("InternalDesc")),"''","'''' ")
and here is what Ray suggests:
SafeIn(Request.Form("InternalDesc"))

and
Function SafeIn(theString)
SafeIn = Replace(theString, "''", "''''")
End Function
The results are the same: when I type in:
won''t

One the page where it is displayed, it looks like:
won''''t

推荐答案

是的,他们都做同样的事情。但是,当您从数据库中返回值时,您不会通过

函数传递该值。那是什么?b $ b你在做什么?你做的事情是:


Response.Write SafeIn(Recordset(" item"))


Ray at work


" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Yes, they both do the same thing. But you do NOT pass that value through
the function when you are RETREIVING a value from the database. Is that
what you''re doing? Are you doing something like:

Response.Write SafeIn(Recordset("item"))

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Ray最近回答了我关于撇号替换的问题,关于如何使用2个函数的建议
他给了我一些代码,名为SafeIn
和Safeout

我很难过看到差异。事实上,结果是相同的。

这是我的旧代码:

替换(修剪(Request.Form(InternalDesc)) ),"''","''''")

这是Ray建​​议的:
SafeIn(Request.Form(" InternalDesc"))<功能SafeIn(theString)
SafeIn = Replace(theString,"''","''''")
结束函数

结果是一样的:当我输入时:
不会

显示它的页面,它看起来像:
赢了'

Ray recently answered my question about apostrophe replacement with advice
on how to use 2 functions for hwich he gave me some code, called SafeIn and Safeout

I''m having a hard time seeing the difference. In fact, the results are the
same.

Here''s my old code:

Replace(Trim(Request.Form("InternalDesc")),"''","'''' ")
and here is what Ray suggests:
SafeIn(Request.Form("InternalDesc"))

and
Function SafeIn(theString)
SafeIn = Replace(theString, "''", "''''")
End Function
The results are the same: when I type in:
won''t

One the page where it is displayed, it looks like:
won''''t



我认为他只是建议使用一个函数来封装逻辑

而不是必须在任何地方写出replace()废话。他并没有试图改变这种效果。


" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
I think he was just suggesting using a function to encapsulate the logic
instead of having to write out that replace() crap everywhere. He wasn''t
trying to change the effect.

"middletree" <mi********@htomail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Ray最近回答了我关于撇号替换的问题,关于如何使用2个函数的建议
他给了我一些代码,名为SafeIn
和Safeout

我很难过看到差异。事实上,结果是相同的。

这是我的旧代码:

替换(修剪(Request.Form(InternalDesc)) ),"''","''''")

这是Ray建​​议的:
SafeIn(Request.Form(" InternalDesc"))<功能SafeIn(theString)
SafeIn = Replace(theString,"''","''''")
结束函数

结果是一样的:当我输入时:
不会

显示它的页面,它看起来像:
赢了'

Ray recently answered my question about apostrophe replacement with advice
on how to use 2 functions for hwich he gave me some code, called SafeIn and Safeout

I''m having a hard time seeing the difference. In fact, the results are the
same.

Here''s my old code:

Replace(Trim(Request.Form("InternalDesc")),"''","'''' ")
and here is what Ray suggests:
SafeIn(Request.Form("InternalDesc"))

and
Function SafeIn(theString)
SafeIn = Replace(theString, "''", "''''")
End Function
The results are the same: when I type in:
won''t

One the page where it is displayed, it looks like:
won''''t



当我进行request.form之前,我正在这样做数据库

" Ray at<%= sLocation%>" < myfirstname at lane34 dot com>在消息中写道

news:eA ************* @ tk2msftngp13.phx.gbl ...
I am doing it when I do a request.form, before it goes into the database
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eA*************@tk2msftngp13.phx.gbl...
是的,他们都做了一样。但是,当您从数据库中返回值时,不会通过该函数传递该值。是吗
你在做什么?你做的事情是:

Response.Write SafeIn(Recordset(" item"))

雷在工作

" middletree" < MI ******** @ htomail.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Yes, they both do the same thing. But you do NOT pass that value through
the function when you are RETREIVING a value from the database. Is that
what you''re doing? Are you doing something like:

Response.Write SafeIn(Recordset("item"))

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Ray最近回答了我的问题撇号替换
关于如何使用2个函数的建议他给了我一些代码,名为SafeIn
Ray recently answered my question about apostrophe replacement with advice on how to use 2 functions for hwich he gave me some code, called SafeIn


安全

我很难看到差异。事实上,结果是
相同。

这是我的旧代码:

替换(修剪(Request.Form(InternalDesc)) ),"''","''''")

这是Ray建​​议的:
SafeIn(Request.Form(" InternalDesc"))<功能SafeIn(theString)
SafeIn = Replace(theString,"''","''''")
结束函数

结果是一样的:当我输入时:
不会

显示它的页面,它看起来像:
赢了'

Safeout

I''m having a hard time seeing the difference. In fact, the results are the same.

Here''s my old code:

Replace(Trim(Request.Form("InternalDesc")),"''","'''' ")
and here is what Ray suggests:
SafeIn(Request.Form("InternalDesc"))

and
Function SafeIn(theString)
SafeIn = Replace(theString, "''", "''''")
End Function
The results are the same: when I type in:
won''t

One the page where it is displayed, it looks like:
won''''t




这篇关于撇号混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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