Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Delphi Issues

  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Delphi Issues

    Hi
    I am making a log on system in delphi as part of a larger database project and ive run into a bit of an issue.
    I have made a log on system which recalls information from a text file into a memo box and compares information from 2 edit boxes on forename and surname with the contense of the memo box.
    Here is where my problem lies, I have absolutely no idea how to compare the 2 fields. So far I have recalled all the data from the text file to the memo but can't sort it or search it. Later on I will need to use a similar piece of code for my database so any information is much appreciated. Could someone please post some sample code or at least give me an idea of what to do.

    Thanks
    Last edited by reley; 09-27-2011 at 01:47 PM.

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    I don't do Delphi, but does it have an analog to C's strcmp() or stricmp()?

    The first is a case-sensitive string compare, the second is a case-insensitive string compare, I think you could compare the two fields with a similar function in Delphi.

    Here, look at the first two functions listed on this page, they seem to be what you need:
    http://www.delphibasics.co.uk/ByFunc...ings&Sub=Calcs
    Last edited by morongo47; 09-29-2011 at 03:10 AM.

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thankyou

    Cheers for the link but I need someone who knows delphi inside out to full explain what to do. I've been researching it for weeks and I still cant find anything thats any help, and no it doesnt have any script like that (or not that ive seen anyway) Thanks all!


    By the way any pascal responses will be useful aswell
    Last edited by reley; 09-30-2011 at 11:59 AM.

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    oops, double-posted, see below...
    Last edited by morongo47; 09-30-2011 at 08:21 PM.

  • #5
    New Coder
    Join Date
    Sep 2011
    Posts
    43
    Thanks
    6
    Thanked 6 Times in 6 Posts
    The example they give seems pretty straightforward, pass the two strings you're interested in to this procedure and 'result' will be 0 if they match and something else if they don't (in this case Tform1 is just an example class that uses CompareStrings as a method):
    Code:
    procedure TForm1.CompareStrings(const string1, string2: string);
    var
      result : Integer;
    begin
    
    
    //uncomment if case-sensitive: 
       result := AnsiCompareStr(string1, string2);
    
    //uncomment to ignore case: 
    // result := AnsiCompareText(string1, string2);
    
    end;
    ...and no it doesnt have any script like that...
    Well it won't, until you edit it in. Have you tried compiling it 'as-is' to make sure you have all your unit-code in-place (your build environment is valid) and it will actually re-compile?

    In any event, if no actual Delphi programmers respond to this post and you need more in-depth explanations, you might try a more delphi-specific board such as these:

    http://www.delphipages.com/forum/forumdisplay.php?f=3

    http://www.programmersheaven.com/mb/Delphi/Board.aspx
    .
    Last edited by morongo47; 09-30-2011 at 08:41 PM.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •