Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 48
Registered: ‎07-20-2010
My Device: Not Specified
My Carrier: developer
Accepted Solution

i want to split strings !!!

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

www.myvideo.fly

this is the url fetched and stored in the vector means.. i want it as..

www.myvideo.3gp

 

please give me some idea... its very URGENT !!!!!!!!!!

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: i want to split strings !!!

you can use String.substring to do this.

maybe some basic java course would be helpful.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 44
Registered: ‎07-27-2010
My Device: Tour
My Carrier: Verizon Wireless

Re: i want to split strings !!!

this may help

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/832062/How_To_...

 

hopefully the link will work, its an article in the knowledge base

How To - Implement a string splitter based on a given string delimiter
Last Updated: 24 March 2009
Article Number: DB-00728
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: i want to split strings !!!

Trusted Contributor
Posts: 138
Registered: ‎07-11-2010
My Device: Bold 9700
My Carrier: O2

Re: i want to split strings !!!

[ Edited ]
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.

 

Contributor
Posts: 48
Registered: ‎07-20-2010
My Device: Not Specified
My Carrier: developer

Re: i want to split strings !!!

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...

Contributor
Posts: 48
Registered: ‎07-20-2010
My Device: Not Specified
My Carrier: developer

Re: i want to split strings !!!

wow ABoul !!!!!!!!!! superb.. its the exact answer ...thanks.. thanks a lot...

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: i want to split strings !!!

Hello,

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. Smiley Happy

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!