Autor Beitrag
Darkpara
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Do 10.01.08 21:51 
jo ich hab einen grösseren text welcher zusammenhängend geschrieben ist. dieser ist im moment in einem TLabel formatiert so wie er sein sollte. nun möchte ich ein gewisses wort mitten im text beim laden der seite verändern..

wie macht ich das am besten? kann ich im Label drinne eine php variabel einfügen?
muss ich mit mehreren labels arbeiten? aber dann ist der text nicht mehr zusammenhängend :(

wär nice wenn wer eine idee hätte thx im voraus
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 10.01.08 21:59 
Hi!
Die Funktion, pos(), delete, Insert() sollten Dir weiterhelfen.
Wobei das nicht gerade elegant ist. :?

Hatte die Frage nicht korrekt gelesen.

Gruß
Marc
Darkpara Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Do 10.01.08 22:18 
hm an das dachte ich auch schon aber der text erweiter sich alle paar tage glaub das wär zimlich umständlich :/

vl. hat ja noch einer ne "sauberere" lösung
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 11.01.08 01:46 
Ich würde einfach einen Platzhalter wie %%NAME%% oder so nehmen und den dann mit ReplaceString oder so durch den konkreten Wert ersetzen.
Darkpara Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Fr 11.01.08 13:51 
hab nun mit replace string gemacht danke.

sollte doch noch wer eine variante mit einer variabeln IM Label kennen würd ich die gerne auch kennen
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Fr 11.01.08 14:40 
Warum ist mir Format nicht auf Anhieb eingefallen? :P
Was hälst Du denn von Folgendem:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure replaceword(word: string; lbl: TLabel);
var
 s: string;
begin
  s := 'Dies ist ein %s Test!';
  lbl.Caption := Format(s,[word]);
end;

  replaceword('einfacher', label1);


Grüße
Marc
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 11.01.08 17:46 
Format ist mir gestern auch eingefallen, nur die Umsetzung scheiterte :-P

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)