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 3 of 3

Thread: Probably easy String parsing

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Probably easy String parsing

    Hi
    I hope this is the right place for my question:

    I have a String formated in the same way as package names:

    "com.darkchanter.code.NameValue"

    Now I need to extract "NameValue" - the problem doesn't actually block my stuff, but before I write my own code, I Wonder if there is a function already available...

    Thanks
    Roger


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Probably easy String parsing

    Not that I know of, but the code required using existing String methods would be ~2 lines.

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: Probably easy String parsing

    Read the documentation for the String class. There are many different ways of doing it.
    My suggestion would be to use the methods lastIndexOf(char c) and substring(int from, int to).

Similar Threads

  1. Replies: 1
    Last Post: April 19th, 2012, 02:46 AM
  2. Parsing a string to an int while receiving user input?
    By happyxcrab in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 11th, 2011, 05:38 PM
  3. Parsing many Ints from a user input String.
    By helpmeplease111 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 7th, 2011, 08:41 PM
  4. Parsing Scientific Notation from String
    By aussiemcgr in forum Java Theory & Questions
    Replies: 7
    Last Post: December 14th, 2010, 09:45 AM
  5. String + Compare // Might be too easy for ya
    By Jangan in forum Java Theory & Questions
    Replies: 1
    Last Post: October 18th, 2009, 05:40 PM