08-12-2010 09:37 AM
hi everyone.. i m fetching a url and storing it in a vector.. i need to remove the last 4 characters of the url.. i.e say
this is the url fetched and stored in the vector means.. i want it as..
please give me some idea... its very URGENT !!!!!!!!!!
Solved! Go to Solution.
08-12-2010 09:44 AM
you can use String.substring to do this.
maybe some basic java course would be helpful.
08-12-2010 09:54 AM
this may help
hopefully the link will work, its an article in the knowledge base
|How To - Implement a string splitter based on a given string delimiter|
08-12-2010 10:25 AM - edited 08-12-2010 10:25 AM
String oldURL = "www.myvideo.fly"; String newURL = oldURL.substring(0, oldURL.length() - 3) + "3gp";
i think everyone is confusing what you mean by "split" to what java means by "split()". just do something like the above.
08-12-2010 11:41 AM
hi friends.. thanks for ur replies.. but that link dint get me solution.. they have given solution to remove the string at the first part of the string... say....in " sujayarun " .. they given to remove su.. etc.. and another is they had given to add strings at the end.. i want to remove last 3 characters from my string.. so....pls...
08-12-2010 11:56 AM
I guess you are trying to jump over your head here. You are obviously very new to Java, so you have to go slowly at first. Start reading some good Java book - my personal favorite is "Thinking in Java" by Bruce Eckel, but there are many others - and go through several first examples. The question you ask is really basic, and once you are through a few chapters you will be able to solve such problems with ease. Moreover, you will have an overall much better grasp of Java as a whole than you would if you asked here many questions and got fully-coded responses. By asking "give me some code!!!" you are doing a great disservice to yourself. Oh, and by not "doing your homework" you will not be able to recognize when a perfectly good code is thrown your way (which is already the case).
If you care about your programming career, LEARN! Learn now, learn later... always learn. Software engineering is like this - learning sows the seeds so that you can reap benefits later. Continuous learning lets you reap continuous benefits.