---
title: "ASP判断是否为空"
author: "编程足球"
date: "2012-03-29T12:38:06Z"
tags: []
categories: ["编程语言"]
slug: "asp"
draft: false
lastmod: "2012-03-29T12:38:06Z"
id: 1468738
url: "https://lingf.iteye.com/blog/1468738"
---

判断是否为空常用如下方法
判断指定对象是否为空值, 包含大部分情况, 譬如空数组,空字符串,Empty和Null对象等等

```java

Private Function IsBlank(byref TempVar)
	IsBlank = False
	Select Case VarType(TempVar)
		Case 0, 1 '--- Empty & Null
			IsBlank = True
		Case 8 '--- String
			If Len(TempVar) = 0 Then
				IsBlank = True
			End If
		Case 9 '--- Object
			tmpType = TypeName(TempVar)
			If (tmpType = "Nothing") Or (tmpType = "Empty") Then
				IsBlank = True
			End If
		Case 8192, 8204, 8209 '--- Array
			If UBound(TempVar) = -1 Then
				IsBlank = True
			End If
	End Select
End Function

```



![](http://dl.iteye.com/upload/attachment/0065/6784/eb998176-a4cb-3980-a21f-0a94e4a64a2d.jpg)