CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Extract Text

  1. #1
    Join Date
    May 2018

    Extract Text

    Good morning,

    I have a text field and need to extract out the numbers so I can create a formula to calculate the variance. See example below
    Discount: Rate changed from -799,960.00 to -1,031,100.00
    The numbers would change each time but the rest of the verbiage would be the same. Any assistance would be greatly appreciated.

    Thank you


  2. #2
    Join Date
    Aug 2007

    Re: Extract Text

    As long as you can 100% rely on the text always being in the field at the same relative positions, then you can use the text as anchor points for extracting portions of the string:
    ToNumber(mid({Command.FIELDA},(instr({Command.FIELDA},"from") + 5),(instr({Command.FIELDA}," to ") -(instr({Command.FIELDA},"from") + 5))))
    and formula2
    ToNumber(mid({Command.FIELDA},instr({Command.FIELDA}," to ") + 4))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)