How would give this code// Comments - Released
curPos := Pos('<h3>Comments</h3>', HTML);
if curPos > 0 then begin
LogMessage('Scene readout');
EndPos := curPos;
curPos := PosFrom ('<li style="padding-bottom: 0.5em;">Released:',HTML,curPos);
if curPos > 0 then begin
curPos := PosFrom('">Released:',HTML,curPos);
if curPos > 0 then begin
curPos := curPos + Length('">Released:');
EndPos := PosFrom('</li><',HTML,curPos);
Datanascita := Copy(HTML,curPos,EndPos-curPos);
LogMessage(Datanascita);
if Datanascita <> '' then begin
ExplodeString(Datanascita, DateParts, ' ');
DateParts[0] := StringReplace(DateParts[0], '01', '1', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '02', '2', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '03', '3', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '05', '5', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '06', '6', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '07', '7', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '08', '8', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '09', '9', True, True, False);
DateParts[1] := StringReplace(DateParts[1],'January','1',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'February','2',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'March','3',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'April','4',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'May','5',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'June','6',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'July','7',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'August','8',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'September','9',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'October','10',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'November','11',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'December','12',true,true,true);
Datanascita:= DateParts[0] +'.'+ DateParts[1] +'.'+ DateParts[2];
LogMessage('release : '+ Datanascita);
AddFieldValueXML('release', Datanascita);
end
else
LogMessage('release not found');
end
else
LogMessage('Data di nascita: NESSUNA');
end;
end;
to regulate, it would not be necessary always to use this piece of code DateParts[0] := StringReplace(DateParts[0], '01', '1', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '02', '2', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '03', '3', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '05', '5', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '06', '6', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '07', '7', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '08', '8', True, True, False);
DateParts[0] := StringReplace(DateParts[0], '09', '9', True, True, False);
DateParts[1] := StringReplace(DateParts[1],'January','1',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'February','2',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'March','3',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'April','4',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'May','5',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'June','6',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'July','7',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'August','8',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'September','9',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'October','10',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'November','11',true,true,true);
DateParts[1] := StringReplace(DateParts[1],'December','12',true,true,true);
repeatedly used to Released date converted to this format, for example, as follows 30.10.2013
I guess it would be necessary to add to the script similar functions like this, for example,// ******** CheckDate ************** Преобразовывает строку с датой в короткий формат ****
function CheckDate(s: String): String;
var
i, j, num : Integer;
months : Array [1..12] of AnsiString;
items : TWideArray;
Day, Month, Year : String;
begin
months[ 1] := 'январ';
months[ 2] := 'феврал';
months[ 3] := 'март';
months[ 4] := 'апрел';
months[ 5] := 'ма';
months[ 6] := 'июн';
months[ 7] := 'июл';
months[ 8] := 'август';
months[ 9] := 'сентябр';
months[10] := 'октябр';
months[11] := 'ноябр';
months[12] := 'декабр';
ExplodeString (s, items, ' ');
for i := 0 to 2 do begin
if i > High (items) then Break;
num := StrToInt (items[i]);
if num > 0 then begin // День или год
if num <= 31 then // День
Day := items[i]
else if (num >= 1000) And (num <= 2200) then begin // Год
Year := items[i];
Break; // Год - последний
end;
end else begin // Месяц
for j := Low (months) to High (months) do
if Pos (months[j], LowerCase (items[i])) > 0 then Break;
end;
if j <= High (months) then
Month := IntToStr (j);
end;
if Year <> '' then begin
if Day = '' then
Day := '01'
else if length (Day) = 1 then
Day := '0' + Day;
if Month = '' then
Month := '01'
else if length (Month) = 1 then
Month := '0' + Month;
Result := Day + '.' + Month + '.' + Year;
end else
Result := s;
end;
// ******** CheckDates ************** Преобразовывает строку с датами, разделенными запятыми, в короткий формат ****
function CheckDates (s: String): String;
var
Dates : TWideArray;
i : integer;
Begin
ExplodeString (Replace (s), Dates, ',');
Result := '';
for i := low (Dates) to high (Dates) do begin
if Result = '' then
Result := Result + CheckDate (Dates[i])
else
Result := Result + ',' + CheckDate (Dates[i]);
end;
End;
but this I have never used and I admit that I do not know how to do this, so please help, I would be happy with the attached code.