Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

pattern matching  RSS feed

 
Shruthi Babu
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to retrieved the strings of a particular pattern in a string.

for example need to retrieve all the string which are between ($ ).

($ test)\ProgramFiles\($test1)

I need the values ($test) and ($test1) what is the best way to get the same,

Any help is highly appreciated.

Thanks
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're here to help, but we think the best way to help you learn is to help you do the work. So instead of just providing a solution, we want to see what you've already tried and where you're stuck.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks to me like your are going to be passed a path to a certain file or folder.

so what you can do is use StringTokenizer and set the delimeter to '\'.

sun's API documentation is most likely the best organized and readily available API on the planet, so use it .

Justin Fox
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!