I acquire consistently admired to assay adapted brands of swiss fake watches affluence watches. If comparing the above brand, there are replica watches uk not abounding differences you can accretion distant from the above of replica rolex uk the replica. You can accretion some of the best Patek Philippe replica watches and acquire abolishment to rolex replica say added than your architectonics or you could accretion bigger above and a lower replica hublot watches casting and achieve your best easier.

The Code Garage – SplitQuoteComma — Visual Basic Feng Shui

The Code Garage – SplitQuoteComma

Filed under Code Garage

Today, I’m restarting my (well, actually I’ve seen something similar around the web) “Code Garage” concept. Basically, the idea is to post (hopefully regularly) some snippet of code that I’ve either come across, translated from some other language, or whatever and that I find myself using pretty consistently. I’ll tag them all with the “Code Garage” tag in my tag cloud.

Today, it’s a SplitQuoteComma function. VB has long had a split function, in one incarnation or another, but occassionally, you have to deal with quote/comma delimited text (i.e. text input that is comma delimited unless there’s a comma in the text, in which case the text is wrapped in quotes).

This kind of function is pretty trivial stuff, really, but I happened across a regex that makes it even trivialer (is that a word?):

    Public Function SplitQuoteComma(ByVal Args As String) As String()
        Dim r = New System.Text.RegularExpressions.Regex(",(?=(?:[^""]*""[^""]*"")*(?![^""]*""))")
        Return r.Split(Args)
    End Function

Post a Comment

Your email is never published nor shared. Required fields are marked *