Инструменты пользователя

Инструменты сайта


works:programmer:delphi:widestring

Тонкая работа с WideString даже в старых версиях

Методы:

  • WideStrStartsWith
  • WideTextStartsWith
uses SysUtils, WideStrUtils;
 
function WideStrStartsWith(const ANeedle, AHaystack: WideString): Boolean;
var L, L2: Integer;
begin
    L := WStrLen(PWideChar(ANeedle));
    L2 := WStrLen(PWideChar(AHaystack));
    if L > L2 then
        Result := False
    else
        Result := WideSameStr(ANeedle, Copy(AHaystack, 1, L));
end;
 
function WideTextStartsWith(const ANeedle, AHaystack: WideString): Boolean;
var L, L2: Integer;
begin
    L := WStrLen(PWideChar(ANeedle));
    L2 := WStrLen(PWideChar(AHaystack));
    if L > L2 then
        Result := False
    else
        Result := WideCompareText(ANeedle, Copy(AHaystack, 1, L)) = 0;
end;
works/programmer/delphi/widestring.txt · Последнее изменение: 2024/10/15 00:22 — tuxapuk

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki