Dear friends, I know how to use trim() but in my project we been told to write a code which do the same job as trim(), i tred it but it is not working, oooH, we are not allowed to use trim() if any one of you have any thing in mind about this then please write back to this DUM boy ..........lol thanks for your time Amit
Why are you forbidden from using trim()? If you need to use trim(), use it, if you can't, there are lots of programming languages out there besides Java. Sorry, small rant there, A.P. It's nothing personal, but I'm joining the growing hordes of people who have problems with requests like, "Hi, I need to use Java to store text in a variable? But I can't use Strings. Please help, URGENT." If it helps you, though, amit_patel2786, here is the actual code for trim() from java.lang.String:
Maybe you can tweak this code to perform as you'd like it to. Art [This message has been edited by Art Metzer (edited April 20, 2001).]
Art, it sounds like an exercise. Actually it might be fun to try to write a trim() method (without looking at src.jar).
Joined: Apr 11, 2001
Dear Art Metzer, Thanks for the code, i know that i can use many other languages for this trim(), but when u get project from the open university and when they say that by using java and without using the actual trim() method how can u use any other language ? or can use just trim() method ? hope u understand the problem ? it is not that hard for the person like u how knows how to do trim() ! many thanks for the code ! Good day Amit
amit_patel2786, The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at "JavaRanch Naming Policy" . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
"JavaRanch, where the deer and the Certified play" - David O'Meara