---
title: "förkorta id"
type: "forum-thread"
url: "https://www.webforum.nu/amne/webbutveckling/153783-förkorta-id"
topic: "Webbutveckling"
topic_url: "https://www.webforum.nu/amne/webbutveckling"
author: "lucgo446"
published: "2006-11-15T08:35:35.000Z"
updated: "2006-11-15T09:44:30.000Z"
replies: 2
views: 317
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/webbutveckling/153783-förkorta-id"
---

# förkorta id

## #1 — lucgo446, 2006-11-15T08:35Z

Hej!

Våra unika idn i databasen börjar bli långa, 6 till 8 siffrigt. 
Hur skulle man kunna göra ett alias som blir kortare?
Med hjälp av bokstäver kanske? 
typ hux9p blir 10252620

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

## #2 — Peeer, 2006-11-15T08:54Z

Ta en titt på [dechex()](http://se.php.net/dechex) och [hexdec()](http://se.php.net/manual/en/function.hexdec.php)

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

## #3 — lucgo446, 2006-11-15T09:44Z

tack det funkar!

.net:

```
    protected void ToHEX(object sender, EventArgs e)
    {
        try
        {
            long l = long.Parse(txt.Text);
            txt.Text = String.Format("{0:x2}", l);
        }
        catch { }
    }

    protected void ToDEC(object sender, EventArgs e)
    {
        try
        {
        txt.Text = long.Parse(txt.Text, NumberStyles.HexNumber).ToString();
        }
        catch { }
    }
```

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

---

Tråden på webben: https://www.webforum.nu/amne/webbutveckling/153783-förkorta-id
