Can anyone lead me to the right direction on how to do this:
I want toreplace all text after a certain character or symbol
Say a line in the text file contains ":"
I want everything after the ":" on that line to replaced with other text
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.
Can anyone lead me to the right direction on how to do this:
I want toreplace all text after a certain character or symbol
Say a line in the text file contains ":"
I want everything after the ":" on that line to replaced with other text
Store the entire line of text to a String variable.
Use String method(s) to find the location/index of the certain character or symbol,
Use other String method(s) to replace characters after the certain character or symbol with the desired characters.
There are 2 or 3 other approaches that occur to me. Perhaps those or variations on the above outline will come to you as you learn about the available String methods on the String API page.
you can use some different approaches...
i'll try to write 2 of them...
Code removed for spoonfeeding
Last edited by jps; November 25th, 2013 at 06:32 PM. Reason: spoonfeeding