如果Object是String,测试的语法是什么? [英] What is syntax to test if Object is a String?

查看:44
本文介绍了如果Object是String,测试的语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道检查Object是否为字符串的语法。


如果是数字测试,我可能会使用IsNumeric。

但是没有功能:IsString(有吗?)

-

Joe Fallon


I would like to know the syntax to check that an Object is a String.

If it was a number test I might use IsNumeric.
But there is no function: IsString (is there?)
--
Joe Fallon


推荐答案

*Joe Fallon < JF ****** @ nospamtwcny.rr.com> scripsit:
* "Joe Fallon" <jf******@nospamtwcny.rr.com> scripsit:
我想知道检查Object是字符串的语法。

如果是数字测试,我可能会使用IsNumeric。
但是没有功能:IsString(有吗?)
I would like to know the syntax to check that an Object is a String.

If it was a number test I might use IsNumeric.
But there is no function: IsString (is there?)




\\\

Dim o As Object = 2
Dim p As Object =" Hello"

Dim q As Object = Me

MsgBox(TypeOf o Is String)

MsgBox(TypeOf p是字符串)

MsgBox(TypeOf q是字符串)

///


-

Herfried K. Wagner

MVP·VB Classic,VB.NET

< http://www.mvps.org/dotnet>



\\\
Dim o As Object = 2
Dim p As Object = "Hello"
Dim q As Object = Me
MsgBox(TypeOf o Is String)
MsgBox(TypeOf p Is String)
MsgBox(TypeOf q Is String)
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


发布后5秒一定要搞清楚!! < g>


如果Object.GetType是GetType(String)那么


-

Joe Fallon



" Joe Fallon" < JF ****** @ nospamtwcny.rr.com>在留言中写道

新闻:%2 *************** @ TK2MSFTNGP10.phx.gbl ...
Always figure it out 5 seconds after posting!! <g>

If Object.GetType Is GetType(String) Then

--
Joe Fallon


"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
我想知道检查Object是否为String的语法。

如果是数字测试,我可能会使用IsNumeric。
但是没有函数:IsString(有吗?)
-
Joe Fallon
I would like to know the syntax to check that an Object is a String.

If it was a number test I might use IsNumeric.
But there is no function: IsString (is there?)
--
Joe Fallon



2003年10月22日星期三16:39:56 -0400,乔法伦

< jf ****** @ nospamtwcny.rr.com>写道:
On Wed, 22 Oct 2003 16:39:56 -0400, "Joe Fallon"
<jf******@nospamtwcny.rr.com> wrote:
我想知道检查对象是否为字符串的语法。

如果是数字测试,我可能会使用IsNumeric。<但是没有函数:IsString(有吗?)
I would like to know the syntax to check that an Object is a String.

If it was a number test I might use IsNumeric.
But there is no function: IsString (is there?)




如果TypeOf是字符串那么

....



If TypeOf something Is String Then
....


这篇关于如果Object是String,测试的语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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