Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get Value Inside Bracket

Posted on 2009-04-06
4
Medium Priority
?
282 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 1000 total points
ID: 24075546
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 48

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 1000 total points
ID: 24075551
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
ID: 24075610
Hi All,

Let me try first.

Thank you.
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 24075654
Hi All,

It all works.

Thank you very much for your help.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

783 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