---
title: "Ändra if sats till en arrey?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/81202-ändra-if-sats-till-en-arrey"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "voigtann1"
published: "2003-07-03T11:59:33.000Z"
updated: "2003-07-03T14:15:52.000Z"
replies: 3
views: 212
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/81202-ändra-if-sats-till-en-arrey"
---

# Ändra if sats till en arrey?

## #1 — voigtann1, 2003-07-03T11:59Z

```
if (t = "voigt") or (t = "dig") or (t = "child") or (t = "pixel") or (t = "ballon") or (t = "blue") then
```

skulle man kunna göra en arrey med "voigt,dig,child,pixel,ballon,blue mm" så man slipper skriva många OR satser???

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

## #2 — ekke_t, 2003-07-03T12:22Z

```
arr = array("voigt","dig","child","pixel","ballon","blue")

if ubound(filter(arr,t))>0 then

end if
```

Detta kan nog funka...

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

## #3 — voigtann1, 2003-07-03T14:07Z

fungerade inte riktigt som jag ville.. fungerade inte alls bra :e

```
if (t = "voigt") or (t = "dig") or (t = "child") or (t = "pixel") or (t = "ballon") or (t = "blue") then
  response.write "document.write(""" & textpic(nollor&count,t) &""")"
else
  response.write "document.write(""" & nollor&count &""")"
end if
```

så ser hela koden ut ..

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

## #4 — Erik Juhlin, 2003-07-03T14:15Z

Ett dictionary är lämpligt. Snabbare än arrayer när man letar. Dictionariet gör en slags checksum av namnet som hjälper när den letar efter värdet vilket gör att det går snabbare. Speciellt när man har mycket i dictionariet.

```
Set dic = Server.CreateObject("Scripting.Dictionary")

dic("voigt") = 1 : dic("dig") = 1 : dic("child") = 1
dic("pixel") = 1 : dic("ballon") = 1 : dic("blue") = 1

If dic.Exists(t) Then

End If

Set dic = Nothing
```

Vill du ha det case-insensitive så kan du slänga in dic.CompareMode = 1 'TextCompare direkt efter Server.CreateObj... :)

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/81202-ändra-if-sats-till-en-arrey
