CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2015

    I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89


    I need the 13.476 out of the above string

    the data look like this


  2. #2
    Join Date
    Feb 2015

    Re: I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89

    This is what I have I just can't get it to come out right
    If instr(Trim({Flat_panel1.jmaPartShortDescription}), "-") <> 0 THEN
    If instr(Trim({Flat_panel1.jmaPartShortDescription}), "x") <> 0 Then
    startPos1 = instr(Trim({Flat_panel1.jmaPartShortDescription}), "x") - 1
    Stileandrail = right(Trim({Flat_panel1.jmaPartShortDescription}),startPos1)
    Stileandrail = Trim({Flat_panel1.jmaPartShortDescription})
    End IF

    xposition = instr(Stileandrail, "x")
    startpos2 = len(Stileandrail) - xposition
    formula = Right(Stileandrail,startpos2)

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: I need to get what is between the "-" and the "x" 12.450X5.65-13.476x12.89

    I'm not a crystal expert, but why not use mid() to extract the required info. Something along these lines (not tested and not complete)
    str1 = instr({Flat_panel1.jmaPartShortDescription}, "-")
    str2 = instr({Flat_panel1.jmaPartShortDescription}, "x")
    if str1<> 0 then
        if str2 <> 0 then
           number = trim(mid({Flat_panel1.jmaPartShortDescription}, str1 + 1, str2 - str1 - 1))
           number = trim(mid({Flat_panel1.jmaPartShortDescription}, str1 + 1))
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++20 Compiler: Microsoft VS2022 (17.0.2)

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