Solved

Get Value Inside Bracket

Posted on 2009-04-06
4
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 250 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 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 250 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Asp.Net Session Question 2 49
VB.net Is there code behind PowerPivot 2 70
vb.net code 9 28
Script to transfer files from web server to sharePoint server 3 34
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…

739 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