dhertzfe
asked on
Proper Case routine
Hello,
Anyone out there have a string routine to convert names to proper case. My database has all customer names in upper case and I wnat to convert them to proper case.
Thanks,
Chad
Anyone out there have a string routine to convert names to proper case. My database has all customer names in upper case and I wnat to convert them to proper case.
Thanks,
Chad
ASKER
Steve,
THis is pretty good. It even handle O'Doole correctly. If you add Mc and Mac like McDonald and MacAuthur I'll raise the points another 100 and award them to you.
Thanks,
Chad
THis is pretty good. It even handle O'Doole correctly. If you add Mc and Mac like McDonald and MacAuthur I'll raise the points another 100 and award them to you.
Thanks,
Chad
If you can wait, i've nearly done finished but got to go now. you hand it a TStrings with whatever 'de','la','mc','mac' etc. you need
so locking question till then.
back soon
so locking question till then.
back soon
Hi Chad,
What Steve is proposing is good. However, I have a comment. I have built case converters for professional products and in every case the robustness of the solution can only be solved by incorporating an exception dictionary. You will be amazed at how people's names don't follow the rules.
Roger
What Steve is proposing is good. However, I have a comment. I have built case converters for professional products and in every case the robustness of the solution can only be solved by incorporating an exception dictionary. You will be amazed at how people's names don't follow the rules.
Roger
i'm just testing... seems ok!
If you reject the proposed answer then and raise the points... :)
Steve
If you reject the proposed answer then and raise the points... :)
Steve
ASKER
Need to....Steve is sending his code and need to raise the points.
Chad
Chad
ASKER
Hi Roger,
Thanks for the heads up.....I will keep that in mind. Its an excellent idea.
Chad
Thanks for the heads up.....I will keep that in mind. Its an excellent idea.
Chad
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
need this too...
function ToLowerCase(S: String): String;
var
I, L: Integer;
begin
L := Length(S);
for I := 1 to L
do S[I] := Chr(Ord(S[I]) or $20);
Result := S;
end;
function ToLowerCase(S: String): String;
var
I, L: Integer;
begin
L := Length(S);
for I := 1 to L
do S[I] := Chr(Ord(S[I]) or $20);
Result := S;
end;
ASKER
Thanks Steve,
Sorry for getting back so late...I guess I wear too many hats.
Thanks again,
Chad
Sorry for getting back so late...I guess I wear too many hats.
Thanks again,
Chad
Thanks Chad,
Glad to be of help.
Glad to be of help.
function ToProper(S: String): String;
var
Delimiter: Boolean;
I, L: Integer;
begin
Delimiter := True;
L := Length(S);
for I := 1 to L
do
if not (S[I] in ['a'..'z', 'A'..'Z'])
then Delimiter := True
else
if Delimiter then
begin
if S[I] in ['a'..'z']
then S[I] := Chr(Ord(S[I]) - 32);
Delimiter := False;
end
else
if S[I] in ['A'..'Z']
then S[I] := Chr(Ord(S[I]) + 32);
Result := S;
end;
Regards,
Steve