CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    [RESOLVED] Trimming the end of a string

    I need to trim the last 4 characters off a string that is not consistent in length.

    Ex: PG 02466 - 0 needs to be PG 02466
    03300 - 1 needs to be 03300
    03 30 00 - 0 needs to be 03 03 00

    The last 4 characters will always be ' - #'

    Any ideas?

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Trimming the end of a string

    Welcome to CodeGuru forums!
    If it is Crystal Reports, then :

    I would use the Left and the Length functions, as :
    Code:
    Left({Tablex.Fieldx}, Length({Tablex.Fieldx}) - 4)
    Last edited by jggtz; September 19th, 2012 at 03:45 PM. Reason: {}
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3
    Join Date
    Sep 2012
    Posts
    2

    Re: Trimming the end of a string

    You are awesome. That was the last piece I needed!

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

Featured