Results 1 to 9 of 9

Thread: [2005] Spliting a string

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    [2005] Spliting a string

    hello,

    I have developed some code below to split a string.

    In a string I get back from a database i have for example "13 Hours". I have to split this and put them into 2 different string variables. So it would separate 13 from hours.

    Does anyone know of any better method to do this.

    Many thanks,

    Code:
    'Split the estimated duration into value and periodically (dates) i.e. "4 Days" to "4" "Days"
    Dim duration As String = Me.DsIncidentsControl.IncidentTask(0).EstimatedDuration
    Dim strArray(2) As String 'Array with 2 element to hold the number and date
                    strArray = duration.Split(" ") 'Split at the space
                    Me.txtEstimatedDuration.Text = strArray(0) 'Assign the number value
                    Me.cboDuration.Text = strArray(1) 'Assign the date
    Last edited by steve_rm; May 2nd, 2007 at 06:38 AM.
    steve

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