Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. compress int to shorter char array (e.g. 12345 --> 3a2)

compress int to shorter char array (e.g. 12345 --> 3a2)

Scheduled Pinned Locked Moved C#
csharpdata-structuresquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M 2000
    wrote on last edited by
    #1

    Hello I want to reduce the length of an integer number to transmit the number. e.g. I have an number e.g. 123456789 and I want to compress it to something like 3a34z1 Is there a standard solution in C#/.net for that? Thanks and best regards, Martin

    L G L 3 Replies Last reply
    0
    • M M 2000

      Hello I want to reduce the length of an integer number to transmit the number. e.g. I have an number e.g. 123456789 and I want to compress it to something like 3a34z1 Is there a standard solution in C#/.net for that? Thanks and best regards, Martin

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What kind of algorithm is that ?

      1 Reply Last reply
      0
      • M M 2000

        Hello I want to reduce the length of an integer number to transmit the number. e.g. I have an number e.g. 123456789 and I want to compress it to something like 3a34z1 Is there a standard solution in C#/.net for that? Thanks and best regards, Martin

        G Offline
        G Offline
        GDavy
        wrote on last edited by
        #3

        Why don^t you just send the integer in stead of a string representation of the number?

        M 1 Reply Last reply
        0
        • G GDavy

          Why don^t you just send the integer in stead of a string representation of the number?

          M Offline
          M Offline
          M 2000
          wrote on last edited by
          #4

          Because it is a long number and I have to pass it manually, e.g. by telephone. So the main target of the algorithm I am looking for is to shorten the integer.

          1 Reply Last reply
          0
          • M M 2000

            Hello I want to reduce the length of an integer number to transmit the number. e.g. I have an number e.g. 123456789 and I want to compress it to something like 3a34z1 Is there a standard solution in C#/.net for that? Thanks and best regards, Martin

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            You can output it to hex, or you can search for the Base36 number article here on CP.**

            xacc.ide-0.2.0 preview - Now in 100% C# goodness

            **

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups