Форум: "Основная";
Текущий архив: 2002.09.30;
Скачать: [xml.tar.bz2];
ВнизWideString Найти похожие ветки
← →
Алексей Ким (2002-09-17 15:22) [0]Как можно сделать ф-цию Pos с WideString?
Я может немного торможу но сам не могу
придумать(для работы с разными языками)
← →
REA (2002-09-17 15:28) [1]1)
The WideString type represents a dynamically allocated string of 16-bit Unicode characters. In most respects it is similar to AnsiString. On Win32, WideString is compatible with the COM BSTR type
2) function AnsiPos(const Substr, S: string): Integer;
Note: This function supports multi-byte character sets (MBCS).
Вроде должно работать.
← →
Алексей Ким (2002-09-17 17:20) [2]2REA сенкс за ф-цию думаю я чтото напортачил...
function ReplText ( Text, ToReplace, ReplaceTo : WideString ) :WideString;
var CharPlace : integer;
begin
while AnsiPos ( ToReplace, Text) > 0 do
begin
Application.ProcessMessages;
CharPlace := AnsiPos ( ToReplace, Text );
Delete ( Text, CharPlace, Length ( ToReplace ) );
Insert ( ReplaceTo, Text, CharPlace);
end;
Result := Text;
trim ( Text );
end;
function ReplaceInFile ( FileName, ToReplace, ReplaceTo: String ): Boolean;
var f: TFileStream;
a: WideChar;
RepText: WideString;
i: Integer;
begin
if not FileExists ( FileName ) then
begin
Result := False;
Exit;
end;
f := TFileStream.Create ( FileName, $0000 );
f.Position := 0;
while f.Position < f.Size do
begin
Application.ProcessMessages;
f.Read ( a, 1 );
RepText := RepText + a;
end;
f.Free;
RepText := ReplText ( RepText, ToReplace, ReplaceTo );
Application.ProcessMessages;
f := TFileStream.Create ( FileName, $0001);
f.Size := 0;
f.Size := Length(RepText);
f.Position := 0;
for i := 1 to Length ( RepText ) do
begin
f.Write ( RepText[i], 1 );
Application.ProcessMessages;
end;
f.Free;
Result := True;
{ TODO 5 -oCore -cCore proccess : Replace procedure }
end;
вот эта ф-ция должна заменять в файле, имя файла проверил и RepText захватывает файл, но ничего не заменяется ??? Может
кто-то подскажет?
← →
REA (2002-09-17 17:27) [3]А это отменили?
function AnsiReplaceStr(const AText, AFromText, AToText: string): string;
← →
Алексей Ким (2002-09-17 19:57) [4]<meta name="KeyWords" content="Eioi?iaoeiiiua oaoiieiaee,DELPHI, o?iee, eiiiiiaiou, aacu aaiiuo, io?aou, SQL ">
Такое вот получается из русского текста
Кажется из-за того что Result: string; а не widestring
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.09.30;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.008 c