Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How do I compare between the array of char and array of words !!?

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How do I compare between the array of char and array of words !!?

    hi guys
    I have a file by a group of words stored in the array , also array of char.
    I want array comparing the letters with the word like it, and return the right word .
    Note: array of char may be some fields are empty.

    for example: char[]={' ','r',' ','e'}
    the word it will be ==tree

    can you help?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How do I compare between the array of char and array of words !!?

    I'm not sure what you are trying to do.
    What would be the results of comparing:
    char[] someChars = {' ','r',' ','e'};
    with
    String str = "tree";

    Are you looking for words that are 4 chars long and have r in 2nd and and e in 4th position?

    Use a loop and one of the String class's methods to get the char one by one
    or put the String into a StringBuffer and do it.
    Last edited by Norm; May 5th, 2012 at 05:39 PM.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Char array to a String array with hex
    By fortune2k in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 20th, 2014, 01:01 PM
  2. [SOLVED] Char Array Increment + 1
    By Nuggets in forum What's Wrong With My Code?
    Replies: 38
    Last Post: April 13th, 2012, 05:35 AM
  3. unable to add my array(Words[]) to PriorityQueue
    By Harini Rao in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 10th, 2012, 07:08 AM
  4. Replies: 2
    Last Post: September 8th, 2011, 09:50 PM
  5. [SOLVED] implementing a dictionary of words using an array of linked lists
    By McTown in forum Java Theory & Questions
    Replies: 3
    Last Post: April 27th, 2011, 02:19 PM

Tags for this Thread