Solved

Get Value Inside Bracket

Posted on 2009-04-06
4
274 Views
Last Modified: 2012-05-06
Hi,

I want to get value inside bracket.

ie. Char(6) --> 6
     VarChar(6) ---> 6

Is there a simple way to do it than using instr function ?

Thank you.
0
Comment
Question by:emi_sastra
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 250 total points
Comment Utility
Here's a way
        Dim str As String = "Char(6)"

        Dim sep() As Char = New Char() {"(", ")"}

        Dim result() As String = str.Split(sep)
 

        MessageBox.Show(result(1))

Open in new window

0
 
LVL 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 250 total points
Comment Utility
The easiest method is to use Regular Expressions....
        Dim s As String = "VarChar(6)"

        Dim regex As New System.Text.RegularExpressions.Regex("\((\d+)\)")

        Dim num As Integer = Convert.ToInt32(regex.Match(s).Groups(1).Value)

Open in new window

0
 
LVL 1

Author Comment

by:emi_sastra
Comment Utility
Hi All,

Let me try first.

Thank you.
0
 
LVL 1

Author Comment

by:emi_sastra
Comment Utility
Hi All,

It all works.

Thank you very much for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now