Bug in AdvShortCutToText

Internally AdvShortCutToText calls MakeUpperLower

Wich is implemented as following


function MakeUpperLower(s: string): string;
var
  Len: Integer;
begin
  Len := Length(s);
  Result := copy(s, 1, 1) + copy(LowerCase(s), 2, Len - 1);
  if (pos('(', Result) > 0) then
    Result := copy(Result, 1, pos('(', Result)) + UpperCase
      (copy(Result, pos('(', Result) + 1, 1)) + copy(Result,
      pos('(', Result) + 2, Len - pos('(', Result) - 1);
end;

You shouldnt be udeing LowerCase og UpperCae but AnsiUpperCase and AnsiLowerCase since the they supports internationally letters.

I would suggest the following implementation

function MakeUpperLower(s: string): string;
var
  Len: Integer;
begin
  Len := Length(s);
  Result := copy(s, 1, 1) + copy(AnsiLowerCase(s), 2, Len - 1);
  if (pos('(', Result) > 0) then
    Result := copy(Result, 1, pos('(', Result)) + AnsiUpperCase
      (copy(Result, pos('(', Result) + 1, 1)) + copy(Result,
      pos('(', Result) + 2, Len - pos('(', Result) - 1);
end;

You can test it with the Danish text 'HØJRE PIL' (Right Arrow)

Thanks, we adapted this.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.