Results 1 to 5 of 5

Thread: Finding the len of a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    Eastern Kentucky
    Posts
    14
    Hello

    I am trying to covert one file to another and the file i am converting from has empty names and i don't want then in my new file so these are what i am using.

    if trim(Len(cu.Name) = 0 then
    if len(trim(cu.name) = 0 then

    are these correct and if not how can i trim the spaces away and set the len to 0.

    i have done this in the past but i just can not get it to work this time.

    thanks for your help

  2. #2
    Junior Member
    Join Date
    Oct 2000
    Location
    Purgatory
    Posts
    31
    You could try:
    Code:
    if strcomp(cu.name, space(len(cu.name)), vbtextcompare) = 0 then
    I'm not positive that it works,
    Paul Bousa

  3. #3

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    maybe with variables?

    Code:
    Y = "   "  <-3 spaces...but no name
    
    Z = Trim(Y)
    if Len(Z) = 0 then
      Y = ""
    end if
    this sets Len(Y) = 0

    hope this helps...

    (not quite sure what your aiming to do)


    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    Let's say cu.name = " " 'three spaces
    trim(Len(cu.Name)) = 3 because len(cu.name) = 3: Trim(3) returns 3
    len(trim(cu.name)) = 0 because trim(cu.name) = "": len("") = 0

    so use len(trim(cu.name))

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