如何使用Len函数计算空间 [英] How To Use The Len Function To Count A Space

查看:82
本文介绍了如何使用Len函数计算空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让Len函数计算字符串末尾的空格?对于

的例子,如果我输入AB(空格),我如何让Len返回3而不是2?


谢谢,


Steve

解决方案



" PC数据表" <无**** @ nospam.spam>在消息中写道

news:ly ****************** @ newsread1.news.atl.earth link.net ...

如何让Len函数计算字符串末尾的空格?对于
示例,如果我输入AB(空格),我如何让Len返回3而不是2?

谢谢,

Steve




Len将在字符串末尾包含一个空格。


?len(" AB")

3


感谢您回复,Randy!


我有两个文本框和一个按钮形成。我可以在

MyTextBox中输入一个字符串,并在按钮的click事件中输入代码,使用Len

函数输出我在MyTextBox中输入的字符数。

按钮代码是:

Me!MyLenOfString = Len(Me!MyTextBox)


如果我键入AB(空格)在文本框中单击按钮,2出现在

MyLengthOfString而不是3.

Steve

" Randy Harris" < RA *** @ SpamFree.com>在消息中写道

新闻:P2 ********** @ newssvr24.news.prodigy.net ...


PC数据表" <无**** @ nospam.spam>在消息中写道
新闻:ly ****************** @ newsread1.news.atl.earth link.net ...

如何让Len函数计算字符串末尾的空格?
对于
例如,如果我输入AB(空格),我如何让Len返回3而不是2?

谢谢,

史蒂夫



Len将在字符串的末尾添加一个空格。

?len(" AB")
3



PC数据表写道:

感谢您的回复,Randy !

表格上有两个文本框和一个按钮。我可以在MyTextBox中输入一个字符串,并在按钮的click事件中输入代码,使用Len
函数输出我在MyTextBox中输入的字符数。
按钮代码是:
我!MyLenOfString = Len(我!MyTextBox)

如果我在文本框中输入AB(空格)并单击按钮,则会出现2 br /> MyLengthOfString而不是3.

Steve

" Randy Harris" < RA *** @ SpamFree.com>在消息中写道
新闻:P2 ********** @ newssvr24.news.prodigy.net ...


PC数据表 <无**** @ nospam.spam>在消息中写道
新闻:ly ****************** @ newsread1.news.atl.earth link.net ...

如何让Len函数计算字符串末尾的空格?
对于
例如,如果我输入AB(空格),我如何让Len返回3而不是2?

谢谢,

史蒂夫



Len将在字符串的末尾添加一个空格。

?len(" AB")
3



http://groups.google.com/group/comp....4ecee81?hl=en&

James A. Fortune


如果您已经得到了这个答案的帮助,请考虑捐赠给以下PayPal网址...... :-)。


How do I get the Len function to count a space at the end of a string? For
example, if I enter AB(space), how do I get Len to return 3 instead of 2?

Thanks,

Steve

解决方案


"PC Datasheet" <no****@nospam.spam> wrote in message
news:ly******************@newsread1.news.atl.earth link.net...

How do I get the Len function to count a space at the end of a string? For
example, if I enter AB(space), how do I get Len to return 3 instead of 2?

Thanks,

Steve



Len will include a space at the end of a string.

?len("AB ")
3


Thanks for responding, Randy!

I have two textboxes and a button on a form. I can enter a string in
MyTextBox and have code in the click event of the button to use the Len
function to output the number of characters I entered in MyTextBox. The
button code is:
Me!MyLenOfString = Len(Me!MyTextBox)

If I type AB(space) in the textbox and click the button, 2 appears in
MyLengthOfString instead of 3.

Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message
news:P2**********@newssvr24.news.prodigy.net...


"PC Datasheet" <no****@nospam.spam> wrote in message
news:ly******************@newsread1.news.atl.earth link.net...

How do I get the Len function to count a space at the end of a string?
For
example, if I enter AB(space), how do I get Len to return 3 instead of 2?

Thanks,

Steve



Len will include a space at the end of a string.

?len("AB ")
3



PC Datasheet wrote:

Thanks for responding, Randy!

I have two textboxes and a button on a form. I can enter a string in
MyTextBox and have code in the click event of the button to use the Len
function to output the number of characters I entered in MyTextBox. The
button code is:
Me!MyLenOfString = Len(Me!MyTextBox)

If I type AB(space) in the textbox and click the button, 2 appears in
MyLengthOfString instead of 3.

Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message
news:P2**********@newssvr24.news.prodigy.net...


"PC Datasheet" <no****@nospam.spam> wrote in message
news:ly******************@newsread1.news.atl.earth link.net...

How do I get the Len function to count a space at the end of a string?
For
example, if I enter AB(space), how do I get Len to return 3 instead of 2?

Thanks,

Steve



Len will include a space at the end of a string.

?len("AB ")
3



http://groups.google.com/group/comp....4ecee81?hl=en&

James A. Fortune

If you have been aided by this answer, please consider a donation to
the following PayPal URL... :-).


这篇关于如何使用Len函数计算空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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