Results 1 to 2 of 2

Thread: HELP! Trim v. Replace v. ????

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Location
    Pittsburgh
    Posts
    6

    Question

    Okay, I have tried both Replace and Trim without any luck. I am trying to dump information straight to a log file instead of a text box. When I do this the Trim/replace function does not work ie. it leaves the spaces and extra characters. This is the line I am trying to use the curvnresult variable has been used with the Registry API's to get the Version of NT then dump it into a log created during the program:

    UpdateLogfile ("Current NT Version - " & Replace(curvnresult, " ", ""))

    Returns:

    Current NT Version - 4.0 0

    I have tried Trim instead of Replace - same result, but if I dump this to a text box either one works!?! Should the Trim or Replace functions work when I dump to the file?? If not, does anyone have any ideas how to eliminate this. I have done it to a point by limiting the buffer size I create for the variable involved with the Version, but this works only because I know that it will never get to big. I am trying to pull the machine name out from the registry as well and get similar results(the extra characters. With that I will not know how big the name will be - 4 characters or 40. Any ideas?
    Sometimes
    Sometimes
    Sometimes
    Always

  2. #2
    Guest
    What are you trying to do exactly? Do you want to split the string up into parts or ??

    The trim function removes only spaces from the start and end of a string. It doesn't remove vbCr or vbLf (or vbCrLf characters.

    The replace function works across the entire string, replacing every instance of a give string with a second string.

    Maybe you would be better off looping through the string and using Mid$ to modifiy the string.

    - gaffa

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