---
title: "Replace på en null sträng"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/10674-replace-på-en-null-sträng"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Pace"
published: "2001-07-20T09:22:00.000Z"
updated: "2001-07-20T09:29:00.000Z"
replies: 4
views: 236
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/10674-replace-på-en-null-sträng"
---

# Replace på en null sträng

## #1 — Pace, 2001-07-20T09:22Z

Varför i he\*\*\*te ger detta felmeddelande:

"Ogiltig användning av Null: 'Replace'"

```
Function htmlSecure(htmlfix)
   If (htmlfix = Null) OR (htmlfix = "") OR (Len(htmlfix) <= 0) Then Exit Function

   htmlfix = Replace(Trim(htmlfix), "<", "<")
   htmlfix = Replace(htmlfix, ">", ">")
   htmlfix = Replace(htmlfix, vbCrLf, "<br>")
   htmlSecure = htmlfix
End Function
```

Jag begriper mig inte på Microsoft...

Permalänk: https://www.webforum.nu/p/10674

## #2 — Vide, 2001-07-20T09:26Z

Du borde nog göra såhär med null:

IsNull(htmlfix)

```
If IsNull(htmlfix) OR (htmlfix = "") OR (Len(htmlfix) <= 0) Then Exit Function
```

Permalänk: https://www.webforum.nu/p/278072

## #3 — Pace, 2001-07-20T09:28Z

Tack Vide!

Men varför funkar inte det andra?

Permalänk: https://www.webforum.nu/p/278073

## #4 — LarsG, 2001-07-20T09:28Z

```

if [b]isNull(htmlfix)[/b] OR (htmlfix = "") OR (Len(htmlfix) <= 0) Then Exit Function
```

Alla jämförelser av typ

```

  värde op null
```

blir alltid falska.

Permalänk: https://www.webforum.nu/p/278074

## #5 — Pace, 2001-07-20T09:29Z

Okej, jag förstår! Tack.

Permalänk: https://www.webforum.nu/p/278075

---

Tråden på webben: https://www.webforum.nu/amne/asp/10674-replace-på-en-null-sträng
