Message Boards Message Boards

0
|
2756 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Using SplitString to get sub-string between 2 delimiters

Posted 11 years ago
Is there a way to use SplitString (or other built-in function) to get a sub-string that is between 2 user specified delimiters? Or is it necessary to create a function to do this iteravtively with SplitString?
POSTED BY: Bob Stephens
3 Replies
Are you looking for something like this?
StringSplit["This is more fun  # than shooting @ a barrelful of monkeys", "@" | "#"]
POSTED BY: W. Craig Carter
Posted 11 years ago
YES - thanks! That is exactly what I was looking for......I had tried adding some boolean content but did not have the syntax correct. Thanks for the solution combined with some bonus humor.
POSTED BY: Bob Stephens
Posted 11 years ago
You can also add to that slightly, and just extract the bit in the middle.


StringSplit["This is more fun  # than shooting @ a barrelful of monkeys", "@" | "#"][[2]]
POSTED BY: Paul Cleary
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract