Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 862627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:10:25+00:00 2026-05-15T09:10:25+00:00

I have a string that I would like represented uniquely as an integer. For

  • 0

I have a string that I would like represented uniquely as an integer.

For example: A3FJEI = 34950140

How would I go about writing a EncodeAsInteger(string) method. I understand that the amount of characters in the string will make the integer increase greatly, forcing the value to become a long, not an int.

Since I need the value to be an integer, I don’t need the numerical representation to be entirely unique to the string.

Maybe I can foreach through all the characters of the string and sum the numerical keycode of the character.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:10:26+00:00Added an answer on May 15, 2026 at 9:10 am

    If these are your requirements:

    1. Some sort of string → integer mapping.
    2. Integers don’t have to be unique.

    Then you’re in luck, because this is exactly what the GetHashCode() method does! The MSDN page gives some sample hash codes. Note that these are completely arbitrary and can change in future versions of the CLR.

    The hash code for “” is: 0x00001505, 5381
    The hash code for “a” is: 0x0002B5C4, 177604
    The hash code for “ab” is: 0x00596E26, 5860902
    The hash code for “abc” is: 0x0B873285, 193409669
    The hash code for “abd” is: 0x0B873282, 193409666
    The hash code for “abe” is: 0x0B873283, 193409667
    The hash code for “abcdef” is: 0x4DDB4BE2, 1306217442
    The hash code for “abcdeg” is: 0x4DDB4BE3, 1306217443
    The hash code for “abcdeh” is: 0x4DDB4BEC, 1306217452
    The hash code for “abcdei” is: 0x4DDB4BED, 1306217453
    The hash code for “Abcdeg” is: 0x941C4FC3, -1810083901
    The hash code for “Abcdeh” is: 0x941C4FCC, -1810083892
    The hash code for “Abcdei” is: 0x941C4FCD, -1810083891

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON string that I would like to include as a value
I have a string property that I would like to be able to force
I have a string that is UTC and would like to convert it to
I have a string of richtext characters/tokens that I would like to feed to
I have my canvas represented as a base64 string. I would like to pass
I have a string that represents a non indented XML that I would like
I just have a handful of Strings that I would like to obfuscate/hide against
Suppose I have a string that contains Ü. How would I find all those
I have to convert an incoming String field into a BigDecimal field that would
I have string that look like Array that fetched from other webservice like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.