Results 1 to 6 of 6

Thread: How to get the values from {}

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2011
    Posts
    60

    How to get the values from {}

    hello Genius
    how to get the values from "{}" as List(of string)

    Code:
     
      Private _data$ = "frameshape{r90}{r-10}{aAzZ}{textlayer}"

    i mean want to split this values like below
    Dim getdatas As New List(Of String)

    getdatas(0) = "r90"
    getdatas(1) = "r-10"
    '''''
    can anybody help me

    Thanks...........

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to get the values from {}

    You could probably use a Regex as well but String.Split is an easy enough option.
    Code:
    Dim data = "frameshape{r90}{r-10}{aAzZ}{textlayer}"
    Dim arr = data.Split({"{"c, "}"c}, StringSplitOptions.RemoveEmptyEntries)
    
    For Each elem In arr
        MessageBox.Show(elem)
    Next
    Note that that will include the "frameshape" too but you can easily enough ignore that.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: How to get the values from {}

    Answer: This seems like a C/C++/C#, type of command syntax!!

    Question: Can I ask why are you working with C command syntaxus, in VB.NET???
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,419

    Re: How to get the values from {}

    here's how with regex:

    vb Code:
    1. Imports System.Text.RegularExpressions
    2.  
    3. Public Class Form1
    4.  
    5.     Private _data$ = "frameshape{r90}{r-10}{aAzZ}{textlayer}"
    6.  
    7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    8.         Dim getdatas As List(Of String) = New Regex("\{(.+?)\}").Matches(_data$).Cast(Of Match).Select(Function(m) m.Groups(1).Value).ToList
    9.     End Sub
    10.  
    11. End Class

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2011
    Posts
    60

    Re: How to get the values from {}

    wow...!!! thanks ...it's working fine sir........
    JMC,Paul thanks for your great codes thank you so much.....

    Can I ask why are you working with C command syntaxus, in VB.NET???
    this is not c,c++ codes ...m getting this values from com component and then react for this values
    sorry for late because of long vacations

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2011
    Posts
    60

    Re: How to get the values from {}

    oops i can't rate your posts WHY ....???? JMC n Paul........

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width