Issue #12: On "Host" tab, prefer visible filename over visible file path

This commit is contained in:
Ansgar Becker
2019-12-25 12:58:36 +01:00
parent ed89b54b28
commit 91f973caed
3 changed files with 22 additions and 6 deletions

View File

@ -271,7 +271,7 @@ type
function implodestr(seperator: String; a: TStrings) :String;
function Explode(Separator, Text: String) :TStringList;
procedure ExplodeQuotedList(Text: String; var List: TStringList);
function StrEllipsis(const S: String; MaxLen: Integer): String;
function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True): String;
function encrypt(str: String): String;
function decrypt(str: String): String;
function HTMLSpecialChars(str: String): String;
@ -456,13 +456,18 @@ end;
@param integer Wished Length of string
@return string
}
function StrEllipsis(const S: String; MaxLen: Integer): String;
function StrEllipsis(const S: String; MaxLen: Integer; FromLeft: Boolean=True): String;
begin
Result := S;
if Length(Result) <= MaxLen then
Exit;
SetLength(Result, MaxLen);
Result[MaxLen] := '<27>';
if FromLeft then begin
SetLength(Result, MaxLen);
Result[MaxLen] := '<27>';
end else begin
Result := Copy(Result, Length(Result)-MaxLen, Length(Result));
Result := '<27>' + Result;
end;
end;