File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how ro get a string from a string

 
adeeb alexander
Ranch Hand
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i want to extract a part of the string. The string is just like this java is a 'programming' language. Now my need is do extract the text between ' ' .How can i achieve this any help would be appreciated.

Thanks and Regards
alexander
 
Scott Bravo
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's the prob in it ,you can do like this ....if still you need some other way please specify in detail ...


 
adeeb alexander
Ranch Hand
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
My requirement is not that see example below you might understand.
String a=" 'porsches car' , 'ferrari,car', yamaha bike ,'sdsDs fare' , efre asfasf ";

How to split that string. I tried to split with split(",") but see at the word 'ferrari,car ' it is one word now how to do. Whwn i use split(",\\s?+") i get the out put some thing like this

'porsches car'
'ferrari
car'
yamaha bike
'sdsDs fare'
efre asfasf

But the word 'ferrari,car' is one word not different the user has given a comma but whenever the user gives like those type of words he will give in between ' '. So the user have given the word ferrari,car like this 'ferrari,car'. Now i am un able to split it.
Hope you got my problem.

Thanks and regards
alexander
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott Bravo wrote:what's the prob in it ,you can do like this ....if still you need some other way please specify in detail ...



Just a small note: when looking for single characters, the indexOf(char) and indexOf(char, int) methods are a little more efficient:
 
Scott Bravo
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adeeb I think Pattern and Matcher class can solve your probelm..try to write a regular expression according to your requirement then do the processing of the text..
-Bravo
 
adeeb alexander
Ranch Hand
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bravo
What you thought is wright. But i need an example to understand it. I need just the simple example.
 
Maneesh Godbole
Saloon Keeper
Posts: 10976
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Scott Bravo
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh has provided a good example check his link
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic