Results 1 to 10 of 10

Thread: String BEFORE & After extraction of specifc data

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    97

    String BEFORE & After extraction of specifc data

    I have the one of the following from data input:

    TRANSPORTATION OF TEMPERATURE CONTROLLED PRODUCT @ -10°F (could be any temperature between -10 and 70°F)
    - OR -
    TRANSPORTATION OF TEMPERATURE CONTROLLED PRODUCT @ DRY

    I want to extract ONLY -10 or DRY (whichever is present) and place it in another textbox. Notice DRY does not have the "°F" after it.

    I suspect a CASE Select will be required but unsure how to pull out only the actual temperature w/o the °F

    Currently I'm using code to take only the last 5 character out of the string as follows:


    Code:
    Dim strSetTemp = MyList.Items.Item(196).ToString
    Dim strTemp As String = strSetTemp.Substring(strSetTemp.Length - 5)
    
            Select Case strTemp
                Case "DRY"
                    tbTemp.Text = "DRY"
                Case Else
                    tbTemp.Text = strTemp
            End Select
    Needless to say, this is not working properly and I end up with either "@ DRY" or -10°F - as expected. I really need to be able to end up with either "DRY" or "-10" - as my end result. I figured a "between" statement would work but unsure how to properly code this.
    Last edited by K3JAE; Sep 28th, 2019 at 07:28 PM.

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