Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stripping a string to get values from within brackets 1

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
GB
Hi,

I've got a String which I'm want to check for the first "(" open bracket, starting from the RIGHT hand side. Then return the content from that bracket to the end of the string.

ie: strSQL:
INSERT INTO tblMyTable (Bla, Bla) VALUES (21, Fred)

I just want from the second bracket to be stored:
(21, Fred)

There may not always be two sets of brackets so it must check from the Right hand side.

Any idea's?? Thankx,
Jonathan
 
Function RightmostBracketString(i_strData As String) As String

Dim lngChar As Long

For lngChar = Len(i_strData) To 1 Step -1
If Mid(i_strData, lngChar, 1) = "(" Then
RightmostBracketString = Mid(i_strData, lngChar)
End If
Next lngChar

End Function

M :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top