Trim Function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmdolcet69

    Trim Function

    I ahve the following code that need to trim off the last character
    from a string

    dim STR as string
    If instr(STR <3 then
    LTrim(STR)


    THis code doesn;t work
  • Clive Lumb

    #2
    Re: Trim Function


    "cmdolcet69 " <colin_dolcetti @hotmail.coma écrit dans le message de news:
    95fe415d-79c5-4b43-8070-5fe0edec4233...l egroups.com...
    >I ahve the following code that need to trim off the last character
    from a string
    >
    dim STR as string
    If instr(STR <3 then
    LTrim(STR)
    >
    >
    THis code doesn;t work
    1 - STR is a reserved name, use mySTR for example
    2 - The line instr(STR <3 is incomplete and meaningless
    3 - "Ltrim" just removes leading spaces
    4 - It looks like you might be using VB6, is this the case?


    Comment

    • ats@jbex

      #3
      Re: Trim Function

      On Thu, 18 Sep 2008 07:19:16 -0700 (PDT), cmdolcet69 wrote:
      I ahve the following code that need to trim off the last character
      from a string
      >
      dim STR as string
      If instr(STR <3 then
      LTrim(STR)
      >
      >
      THis code doesn;t work
      I think the TRIM() function only gets rid of whitespace. Try the LEFT$()
      function:

      dim STR as string
      STR= "STRING"
      STR = LEFT$(STR,3)

      HTH
      --
      ats@jbex

      Boats an' tanks and planes, it's your game
      Kings an' queens an' generals learn your name
      I see all the innocents, the human sacrifice
      And if death comes so cheap
      Then the same goes for life!

      The Clash - Tommy Gun

      Comment

      • Patrice

        #4
        Re: Trim Function

        What if you try STR=LTrim(STR) ? Remember that this is a function i.e it
        don't change the argument. It *returns* a modified string.

        --
        Patrice


        "cmdolcet69 " <colin_dolcetti @hotmail.coma écrit dans le message de groupe
        de discussion :
        95fe415d-79c5-4b43-8070-5fe0edec4233...l egroups.com...
        I ahve the following code that need to trim off the last character
        from a string
        >
        dim STR as string
        If instr(STR <3 then
        LTrim(STR)
        >
        >
        THis code doesn;t work

        Comment

        Working...