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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:23:48+00:00 2026-06-15T11:23:48+00:00

How do you turn a String input into an int array of [][] Like

  • 0

How do you turn a String input into an int array of [][]

Like for example if i have an input of 3a then it should return back to the index of [2][0] and if it have like 5e then it should go to the index of [4][4]

  • 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-15T11:23:49+00:00Added an answer on June 15, 2026 at 11:23 am

    Like this:

    public static void main(String[] args) {
        int[][] array;
    
        array = createArray("3a");
        System.out.println(array.length + "," + array[0].length);
    
        array = createArray("5e");
        System.out.println(array.length + "," + array[0].length);
    
        array = createArray("9g");
        System.out.println(array.length + "," + array[0].length);
    }
    
    private static int[][] createArray(String input) {
        int a = Integer.parseInt(input.substring(0, 1)) - 1;
        int b = input.charAt(1) - 97;
        return new int[a][b];
    }
    

    This outputs:

    2,0
    4,4
    8,6
    

    Also make sure to do some method of validation on the input before passing it into createArray. A simple regex pattern would do the trick for that: [0-9][a-z].

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

Sidebar

Related Questions

I want to turn an array of characters into ONE string. Example: char foo[2]
What's the fastest way to turn a string into a byte[] array in C#?
I'm stringyfing an object like {'foo': 'bar'} How can I turn the string back
I'm trying to turn this XML string into a select I have @Schedule XML
What is the quickest and best performance way to turn a string into a
In XS, how do I turn a string that holds a variable name into
I need to split a keyword string and turn it into a comma delimited
How does one turn any random object into a JSON string using Monodroid's System.Json
Is there a way to turn a char into a String or a String
Okay, I have been studying text input in SDL (how to turn the keystrokes

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.