Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2014
    Posts
    72
    Rep Power
    0

    Default How to compare an integer to a string variable's array?

    I'm trying to do something like this:

    Java Code:
    		for (int i=1; i<2; i++);
    			int randomNum =  rn.nextInt(range) + 1;
    			if (randomNum == CardList.CARD_NAME[randomNum]){
    				
    			}
    But the CARD_NAME variable is a string. I just want to compare the array to the integer.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: How to compare an integer to a string variable's array?

    What array?
    The char[] that is inside the String object?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to compare an integer to a string variable's array?

    Can you give an example of an int and a String that you want to compare and what the expected results would be?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 2
    Last Post: 04-28-2013, 01:50 AM
  2. Replies: 3
    Last Post: 04-24-2013, 02:45 AM
  3. Integer array to String array
    By lakshmibvaraprasad in forum New To Java
    Replies: 1
    Last Post: 07-20-2011, 08:39 PM
  4. How to compare the String with integer
    By JJay84 in forum New To Java
    Replies: 3
    Last Post: 04-08-2011, 09:10 AM
  5. change string to array of integer
    By prof.deedee in forum New To Java
    Replies: 4
    Last Post: 11-09-2009, 02:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •