Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-26-2011, 12:00 PM   PM User | #1
reley
New to the CF scene

 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
reley is an unknown quantity at this point
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..
reley is offline   Reply With Quote
Old 09-29-2011, 03:07 AM   PM User | #2
morongo47
New Coder

 
Join Date: Sep 2011
Posts: 43
Thanks: 6
Thanked 6 Times in 6 Posts
morongo47 is an unknown quantity at this point
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..
morongo47 is offline   Reply With Quote
Old 09-30-2011, 11:57 AM   PM User | #3
reley
New to the CF scene

 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
reley is an unknown quantity at this point
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..
reley is offline   Reply With Quote
Old 09-30-2011, 07:46 PM   PM User | #4
morongo47
New Coder

 
Join Date: Sep 2011
Posts: 43
Thanks: 6
Thanked 6 Times in 6 Posts
morongo47 is an unknown quantity at this point
oops, double-posted, see below...

Last edited by morongo47; 09-30-2011 at 08:21 PM..
morongo47 is offline   Reply With Quote
Old 09-30-2011, 08:20 PM   PM User | #5
morongo47
New Coder

 
Join Date: Sep 2011
Posts: 43
Thanks: 6
Thanked 6 Times in 6 Posts
morongo47 is an unknown quantity at this point
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;
Quote:
...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..
morongo47 is offline   Reply With Quote
Reply

Bookmarks

Tags
delphi

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:54 AM.


Advertisement
Log in to turn off these ads.