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

  • SEARCH
  • Home
  • 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 3977244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:54:02+00:00 2026-05-20T04:54:02+00:00

having a bit of trouble finding a solution to this. I want to take

  • 0

having a bit of trouble finding a solution to this.

I want to take a large ordered text file of words and create – in the same order – a text file of fixed length numeric values.

For example:

Input File           Output File

AAA          ->      00000001
AAH          ->      00002718
AAZ          ->      71827651

Initially it seemed a hash function would do the trick. However they are one way. Also perhaps they are a bit “heavyweight” for this. After all, I don’t need any cryptography. Plus, it’s a reference file. It will never change.

Any compression is a bonus not essential. That said, I don’t want the file to get any bigger than it already is. Which is why I don’t just want to write out the words as text but with fixed lengths.

So, bottom line; input is a NSString of variable length, output is an integer of fixed length. And, I must be able to take the integer and figure out the string.

Any help much appreciated!

Thanks!
xj

  • 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-20T04:54:03+00:00Added an answer on May 20, 2026 at 4:54 am

    Well, this would be a bit of a brute force method, but here’s my guess.

    Start by making a custom function to convert one letter of text to an integer less than 100. (I’m not sure if such a function already exists, if so then great!) You might need to just go to stuff like “if ([input isEqual: @”a”]){ return 1;}

    Then, run that function on each letter of text, and get the final integer by combining the previous results.

    For example:

    int myVal1 = [intConverter firstLetter];
    int myVal2 = [intConverter secondLetter];
    int myVal3 = [intConverter thirdLetter];

    int finalValue =100^3 + 100^2*myVal1 + 100*myVal2 + myVal3;

    Then, finalValue would be of the form 1(myVal1)(myVal2)(myVal3), which is what I think you’re looking for.

    To get back the original string, simply use the mod (%) and division functions to get the individual values back, then run the intConverter function backwards. (This would probably mean writing a new function that basically runs those if statements in reverse, but oh well.)

    I hope this helps.

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

Sidebar

Related Questions

I've read a bit about CSS3 calculations, but I'm having trouble finding this in
I'm having a bit of trouble finding an answer on this: Using Django forms,
Background I'm having a bit of trouble finding out just how to programmatically post
Having a bit of trouble wrapping my head around this one. I'm sure the
I'm having a bit of trouble loading an html file in a WebView control
This question is pretty generic actually, but I'm really having trouble finding a good
I'm having trouble incorporating a bit of logic into a large SQL query. I'm
Having a bit of trouble wrapping my head around Qtimer this morning. Here's the
I'm having a bit of trouble finding a nice little jquery plugin that would
I'm having a bit of trouble finding a reliable method of determining CPU frequency

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.