Hi there,
I haven't visited the forums in quite some time!
How is everyone![]()
Anywho, i've been taking a computer science course this semester and we've been doing java(no fancy ide's..just Textpad ...used to use bluejay)
We have done a few simple games, frogger, etc.. as well as a console app with arrays to sort some tax calculations.
We are currently working on a console app to take a textfile and give the user options to do 1-9 different things... the option i am on at the moment is a Trimming method (i was trying to come up with a simple way to search through the contents stored in a string 's' for different characters such as (! , ' " -) and remove them. Heres what i wrote up today and of course it doesn't work but i'm wondering if trying to get a stringbuffer to work is the right thing or not....or should i use arrays and substrings to accomplish this, i also need to remove whitespace from the strings.
here goes my messy code:
of course i'm calling stringtrimword(s); in my main method before i do system.outprint. I believe i was receiving an error with this code at 'rand' during my setCharAt call.Code:public static String StringTrimWord(String s) { String rand = (""); StringBuffer StringStuff = new StringBuffer(s); int mySearch = StringStuff.indexOf("!"); StringStuff.setCharAt(mySearch, rand); return s; }
That is just an example of the idea i had to accomplish this easily.
Thanks for any input you may have!
- Kevin
![]()




Reply With Quote