Wednesday, March 28, 2012

Substring and ()

Hello,

I have a string which looks as follows:
"asdksdjfssdf@dotnet.itags.org.sdfsdfsdfsdfsdf.com (John Smith)"

How to create a substring with only the part which is between (), i.e.,
the name?

Thanks,

MiguelThere are a couple of ways:

1. Use a Regular Expression
2. Split the string on '(' and remove the ')' from the resulting string
3. Find the position of '(' and ')' with Regex or string search and
substring using these two values to get start and end.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
"shapper" <mdmoura@.gmail.comwrote in message
news:1159644569.490605.218750@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hello,
>
I have a string which looks as follows:
"asdksdjfssdf@.sdfsdfsdfsdfsdf.com (John Smith)"
>
How to create a substring with only the part which is between (), i.e.,
the name?
>
Thanks,
>
Miguel
>

0 comments:

Post a Comment