Missing operator or semicolon - weird error - delphi

Posted on 2007-08-03
Last Modified: 2013-11-22
I have a very weird problem - I keep getting a missing operator or semi-colon error with a length function -
Here is the code:
      pJPEG.CompressionQuality := 80;

      jpglen := Length(sFilename);
      tempjpg := LeftStr(sFilename, jpglen - 4);

      if FileExists(tempjpg) then

If I comment out the jpglen := Length(sFilename) it works fine //sFilename is defined as string and populated earlier
Usually I know it is missing a semi colon on the line above - but as you can see that is not the case here.  I originally had the length function inline in the setting for tempjpg, but then that line failed, which I broke it out to determine where the issue was.  If I set the jpglen to an integer value it will compile with no issues...  
Any help is appreciated - I do not know why it is giving me this error on a length function...
Question by:Chipmunk77
    LVL 10

    Accepted Solution

    Check Like this

          pJPEG.CompressionQuality := 80;

          jpglen := System.Length(sFilename);
          tempjpg := LeftStr(sFilename, jpglen - 4);

          if FileExists(tempjpg) then

    Author Comment

    Thanks!  I never thought of adding the system there...  :-)
    I tried adding it to the uses clause but it kept telling me it was already there - even though it wasn't

    Just for pure curiousity sake - any idea why it needs to be fully qualified?
    LVL 10

    Expert Comment

    i think there is a function with Name Length.
    you put only length function.
    right click on Length function and find declaration.
    then you will identify what is the reason.

    sorry for my bad english

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now