ConvertFrom-String and locating a specific object.

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Gorstag Gorstag 3 months ago.

  • Author
    Posts
  • #65056
    Profile photo of Gorstag
    Gorstag
    Participant

    Setup:

    $strings = "X-Possible-Header1:Value1X-Possible-Header2:Value2X-Possible-Header3:Value3X-File-Name:MyFileX-File-Size:32X-File-Type:PDFX-File-Date:04:22:78
    "
    $strings = $strings.Replace(":",":`r`n")
    $strings = $strings.Replace("X-","`r`nX-")
    $strings = $strings | ConvertFrom-String
    $strings
    
    

    The possible headers in the example above may or may not be there. So then with the convertfrom-string provides the P# objects the order can change.

    Ask:

    I am trying to figure out how to locate a statically named object and take the value of the next P# object which can be different.

    So for example:
    P8 : X-File-Name
    P9 : MyFile

    How would I locate X-File-Name regardless of its P# position and take P#+1 as the value I want returned.

  • #65059
    Profile photo of Gorstag
    Gorstag
    Participant

    Setup:

    $strings = "X-Possible-Header1:Value1X-Possible-Header2:Value2X-Possible-Header3:Value3X-File-Name:MyFileX-File-Size:32X-File-Type:PDFX-File-Date:04:22:78
    "
    $strings = $strings.Replace(":",":`r`n")
    $strings = $strings.Replace("X-","`r`nX-")
    $strings = $strings | ConvertFrom-String
    $strings
    
    

    The possible headers in the example above may or may not be there. So then with the convertfrom-string provides the P# objects the order can change.

    Ask:

    I am trying to figure out how to locate a statically named object and take the value of the next P# object which can be different.

    So for example:
    P8 : X-File-Name
    P9 : MyFile

    How would I locate X-File-Name regardless of its P# position and take P#+1 as the value I want returned.

You must be logged in to reply to this topic.