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 9160029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:38:18+00:00 2026-06-17T13:38:18+00:00

Input Value can be from A to ZZZ (only alphabetical, no numeric characters) how

  • 0

Input Value can be from A to ZZZ (only alphabetical, no numeric characters) how can I validate a from and to field.

Where the input can be A or AA or AAA

  • B > A
  • BB > A
  • BBB > A
  • BBB < B
  • BBB < BB
  • DD > C
    but then D should be < CC fails because it is not a lexicographical order

I was thinking check the length first because if the from length is less than to length then it will always be less. If equal in length then an alphabetical check. Then I come unstuck.

Not simple lexicographical order because three possiable groups single, double, triple chars single group lower than double and triple group and double lower than triple group not just alphabetical.

  • 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-06-17T13:38:19+00:00Added an answer on June 17, 2026 at 1:38 pm

    You can do the following: Imagine the String AAA as a number, saying A*26^2 + A*26^1 + A*26^0

    (Base 26, because there are that much letters)

    Split the String, Cast values A to Z to 1 to 26 (WhiteSpace in front = 0) and you are done:

     A = 0*26^2 + 0*26^1 + 1*26^0 => 1
     B = 2 => 2
     ...
     Z = 26 => 26
     AA = 1 * 26^1 + 1 => 27
     ...
     ZZ = 26*26^1 + 26 = 702
     ...
     ZZZ = 26*26^2 + 26*26^1 + 26 => 18278 
    

    wrap it Like

        public int LetterCodeToInt(String LetterCode)
        {
            //fill up whitespaces in front.
            String s = LetterCode.PadLeft(3, '_').ToUpper();
    
            int value = 0;
            int k = s.Length -1;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != '_')
                {
                    //ASCII "A" is 65, subtract 64 to make it "1" 
                    value += (((int)s[i]) - 64) * Convert.ToInt32(Math.Pow(26, k));
                }
                k--;
            }
            return value;
        }
    

    and you can do:

     if (LetterCodeToInt("AAA") > LetterCodeToInt("AZ")){
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the specified input value from an ajax request callback data?
I have a PasswordBox . how can I get the input value from the
I'm getting input from a text input field on a JSP page, that can
i write a command, or i fill up parameter value from user input field.
How can I get the child-input value; from click event on its parent div-
I am accepting an input from user as a float value. This value can
I'm trying to validate an input field by making sure that only text, spaces
Consider I have a = input(value = ); how can I prevent user from
How can I insert values from a comma-separated input parameter with a stored procedure?
Can someone please let me know how to get values from several input fields?

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.