Mid()功能瘫痪了吗? [英] Mid() function crippled?
问题描述
大家好,
为什么Mid()函数只能在
VBScript的一个方向上工作?此代码适用于VB6但不适用于VBScript?有没有办法围绕它?
?我正在尝试创建一个ASP页面,它生成一个固定宽度的
文本文件,用于导入第三方遗留应用程序,我不会对b
控制。
- 代码示例 -
Dim strSomeString
strSomeString =空格(100)
Mid(strSomeString,1,4)=" test"
Mid(strSomeString,10,20)="别的什么
- 样本 -
谢谢,
肯。
Ken VdB于2004年4月2日在microsoft.public.inetserver.asp.general写道:
Mid(strSomeString,1,4)=" test"
Mid(strSomeString,10,20)=" Something"
不在VBScript中。请阅读规范。
脚本语言vbscript和jscript只处理完整的字符串。
但是你可以创建这样的函数:
函数toMid(插入,插入,开始)
toMid = left(插入,开始)& _
insert& mid(插入,开始+ len(插入))
结束功能
-
Evertjan。
荷兰。
(请在我的电子邮件地址中将x'变为点数)
" Ken VdB" < PU **************** @ nospam.floridus.com>在消息中写道
新闻:uD ************** @ TK2MSFTNGP10.phx.gbl ...大家好,
为什么Mid()函数只能在VBScript的一个方向上工作?此代码适用于VB6但不适用于VBScript?它周围有什么方法吗?我正在尝试创建一个ASP页面,它生成一个固定宽度的文本文件,以便导入到我无法控制的第三方遗留应用程序中。
- -code sample--
Dim strSomeString
strSomeString =空格(100)
中(strSomeString,1,4)=" test"
Mid(strSomeString,10,20)=" Something"
--ee sample -
为Evertjan的回复添加一点,使用与MS相同的术语
文件:
Mid功能 (即,x = mid(...))在VBS中的工作方式与在
VB(或者就此而言,QB)中的工作方式完全相同。 Mid声明 (即,mid(...)= ...),
然而,在VBS中不可用。
Joe Earnest
Joe Earnest于2004年4月3日在
microsoft.public.inetserver.asp.general写道:为Evertjan添加一点的答复,使用与MS
文档相同的术语:
Mid"功能& (即,x = mid(...))在VBS中的工作方式与在VB中(或者就此而言,QB)完全相同。 Mid声明 (即,
mid(...)= ...)然而,在VBS中不可用。
问题在于微软的基础知识系统地试图掩盖声明和函数之间的差异
。
制作让我们 (1980?)声明和呼叫声明(1995?)声明
默认是这个的一部分。
永远不会对确切含义有深刻的理解,如果它们不是历史上倾向的b $ b。
========= ====
mid()语句特别有用,如果stringvariable可以在内部操作
,从而提高速度[= processortime
消费]和空间[=内存消耗]。在解释[= script]
语言内核中,这不如汇编语言[pre]
处理那么有用。
一个不错的inbetween是Forth语言[内核依赖,cource]
其中字符串变量只能在就地操作,如果结果
得到更短,或者保持相同的长度。
另一方面,mid()函数根本没有削弱。
-
Evertjan。
荷兰。
(请在我的电子邮件地址中将x'变为点数)
Hi everyone,
Is there a reason why the Mid() function only works in one direction in
VBScript? This code works in VB6 but not in VBScript? Is there a way
around it? I am trying to create an ASP page which produces a fixed width
text file for import into a third party legacy application which I don''t
have control over.
--code sample--
Dim strSomeString
strSomeString = Space(100)
Mid(strSomeString, 1, 4) = "test"
Mid(strSomeString, 10, 20) = "Something else"
--end sample--
Thanks,
Ken.
Ken VdB wrote on 02 apr 2004 in microsoft.public.inetserver.asp.general:
Mid(strSomeString, 1, 4) = "test"
Mid(strSomeString, 10, 20) = "Something else"
Not in VBScript. Please read the specs.
the script languages vbscript and jscript only handle complete strings.
However you can make a function like that:
function toMid(insert,inserted,start)
toMid = left(inserted,start) &_
insert & mid(inserted,start+len(insert))
end function
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
Hi,
"Ken VdB" <pu****************@nospam.floridus.com> wrote in message
news:uD**************@TK2MSFTNGP10.phx.gbl...Hi everyone,
Is there a reason why the Mid() function only works in one direction in
VBScript? This code works in VB6 but not in VBScript? Is there a way
around it? I am trying to create an ASP page which produces a fixed width
text file for import into a third party legacy application which I don''t
have control over.
--code sample--
Dim strSomeString
strSomeString = Space(100)
Mid(strSomeString, 1, 4) = "test"
Mid(strSomeString, 10, 20) = "Something else"
--end sample--
To add a bit to Evertjan''s reply, using the same terminology as the MS
documentation:
The Mid "function" (i.e., x= mid(...) ) works in VBS exactly as it does in
VB (or, for that matter, QB). The Mid "statement" (i.e., mid(...)= ... ),
however, is not available in VBS.
Joe Earnest
Joe Earnest wrote on 03 apr 2004 in
microsoft.public.inetserver.asp.general:To add a bit to Evertjan''s reply, using the same terminology as the MS
documentation:
The Mid "function" (i.e., x= mid(...) ) works in VBS exactly as it
does in VB (or, for that matter, QB). The Mid "statement" (i.e.,
mid(...)= ... ), however, is not available in VBS.
The problem is Microsoft in its Basics systematically tries to obscure
the difference between a statement and a function.
Making the "Let" (1980?) statement and the "Call" (1995?) statement both
be default is part off this.
Newbees, those that started programming after those days that is, will
never get a deep understanding of the exact meanings, if they are not
historically inclined.
=============
The mid() statement is specially usefull if the stringvariable can be
internally manipulated, thereby improving speed [= processortime
consumption] and space [= memory consumption]. In interpreted [= script]
language kernels this is not as useful as in assembling language [pre]
processing.
A nice inbetween is the Forth language [kernel dependent, of cource]
where a string variable can only be manipulated "in place", if the result
gets a shorter, or keeps the same length.
The mid() function, on the other hand, is not crippled at all.
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
这篇关于Mid()功能瘫痪了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!