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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:49:32+00:00 2026-05-17T21:49:32+00:00

I was wondering if there is a way to compare strings in android with

  • 0

I was wondering if there is a way to compare strings in android with greater than or >.

Lets say I have this:

String numbers = number.getText().toString();
if (numbers.equals("9")){
output.setText("50");}

so if you enter 9 in the number EditText field the output TextView will display 50.
I have quite a few different numbers that will then = a different number but what can I do if I want 10,11,12,13,etc to = 100?

Is there a way to do this by using something like this?

if (numbers.equals("9"++))

or is there some kind of wildcard in android like

if (numbers.equals("1"+"*"))

i know if i replace the * with zero it will be 10 so if this is possible I could make one for 1, one for 2, one for 3, etc. and this would still save me so much code.
If this is not possible let me know if you have any ideas.

Thanks guys!

  • 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-17T21:49:32+00:00Added an answer on May 17, 2026 at 9:49 pm

    You’ll need to convert the String to a number first. Something like this:

    int number = Integer.parseInt(number.getText().toString());
    if (number > 9)
    {
        output.setText("50");
    }
    

    If the String is not guaranteed to be a valid integer you’ll have to handle NumberFormatException too.

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

Sidebar

Related Questions

Im wondering if there is a way in .net to compare strings when they
i have this block of xslt if-else case and was wondering if there's a
I was just wondering if there is a better way to do this. i
I am wondering if there is an easy way to compare a couple of
I was wondering if there was any way that i could compare and index
I am wondering if there is a way to compare successive elements in an
Just wondering is there any way I can check whether the url links to
I was wondering is there a way to give the user a small guided
I was wondering is there a way in visual studio 2010 to search in
I was wondering is there a way in PHP that you could tell where

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.