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,
Miguel
you could either use thestring.indexof to find the locations of the parenthesis and then extract the substring..
or you could look at using regex:http://aspnet.4guysfromrolla.com/articles/022603-1.aspx
Consider
PublicFunction GetPersonsName(ByVal ItemTextAsString)AsString
' Sample data - expects constant format as provided, and without
' sure its not really possible anyway.
' "asdksdjfssdf@.sdfsdfsdfsdfsdf.com (John Smith)"
Dim SplitChars()AsChar = {"(",")"}
Return ItemText.Split(SplitChars)(1)' Returns John Smith
EndFunction
rgds,
Martin.
0 comments:
Post a Comment