AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

replace string in text files

Ein Thema von direktor · begonnen am 17. Jan 2020 · letzter Beitrag vom 21. Jan 2020
 
Benutzerbild von Dalai
Dalai

Registriert seit: 9. Apr 2006
1.684 Beiträge
 
Delphi 5 Professional
 
#2

AW: replace string in text files

  Alt 17. Jan 2020, 18:39
Well, the easy way would be something like this: Read the file into a TStringList variable (Delphi-Referenz durchsuchenTStringList.LoadFromFile) and replace everything in Delphi-Referenz durchsuchenTStringList.Text from (and including) <header> to </header> with "<header>your_new_text</header>" with the Delphi-Referenz durchsuchenStringReplace function. However, I doubt that this will be the fastest way in terms of performance (e.g. because the .Text property makes a copy of the whole string).

[EDIT]
It just came to me that StringReplace in Delphi doesn't work with offsets. So, you probably need to determine the offset of <header> and </header> tags with Delphi-Referenz durchsuchenPos function and use Delphi-Referenz durchsuchenCopy function to get the substring between these tags and then use StringReplace on that substring.
[/EDIT]

Regards
Dalai

Geändert von Dalai (17. Jan 2020 um 20:00 Uhr)
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:56 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz