Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi If Text = 'Heute*irgendwas*' then ? (https://www.delphipraxis.net/45163-if-text-%3D-heute%2Airgendwas%2A-then.html)

Äfan 30. Apr 2005 22:16


If Text = 'Heute*irgendwas*' then ?
 
Hi,

Wie man schon aus dem titel entnehmen kann benötige ich ein irgendwas-zeichen für die if abfrage. Also If Text = 'Heute und dann noch irgendwas anderes dahinter then... Ich habe schon versucht mit If Text = 'Heute*' then, aber des geht nicht. Kann mir einer helfen ?

mfg

Matze 30. Apr 2005 22:20

Re: If Text = 'Heute*irgendwas*' then ?
 
Sollte so ungefair gehen:
Delphi-Quellcode:
if Pos(Text, 'Heute') = 1 then ...

JasonDX 30. Apr 2005 22:21

Re: If Text = 'Heute*irgendwas*' then ?
 
So dürfts gehn:
Delphi-Quellcode:
if pos('Heute', Text) = 1 then
//oder auch
if copy(Text, 1, 5) = 'Heute' then
Beim 1. Schaust du, ob das Wort 'Heute' an der Position 1 im Text vorkommt.
Bei der 2. Version schaust du, ob die ersten 5 Zeichen das wort 'Heute' ergeben

Gambit 30. Apr 2005 22:22

Re: If Text = 'Heute*irgendwas*' then ?
 
if containsText(aText, 'heute') then...

Gruß

Gambit

//sorry, wenn heute an erster Stelle stehen soll, sind o.g Routinen besser

Ultimator 30. Apr 2005 22:23

Re: If Text = 'Heute*irgendwas*' then ?
 
Ich glaube, er möchte darauf hinaus, dass auch bei sowas wie "h*lo" das Wort "Hallo" gefunden wird.

DGL-luke 30. Apr 2005 22:26

Re: If Text = 'Heute*irgendwas*' then ?
 
das geht aber aus der fragestellung nicht hervor.
und es würde sehr viel weiterführen.

Gambit 30. Apr 2005 22:27

Re: If Text = 'Heute*irgendwas*' then ?
 
dann vielleicht mal mit Stichwort "reguläre Ausdrücke" suchen oder googeln...

malo 30. Apr 2005 22:27

Re: If Text = 'Heute*irgendwas*' then ?
 
Zitat:

Zitat von Ultimator
Ich glaube, er möchte darauf hinaus, dass auch bei sowas wie "h*lo" das Wort "Hallo" gefunden wird.

Nein, das "*" soll für einen Text HINTER dem "Hallo" stehen ;)
Zitat:

Also If Text = 'Heute und dann noch irgendwas anderes dahinter then

Äfan 30. Apr 2005 22:28

Re: If Text = 'Heute*irgendwas*' then ?
 
Also an alle die
Delphi-Quellcode:
if pos('Hallo', Text) = 1 then
So meinte ichs, danke :D, allerdings wär das mit dem H*lo auch interessant !

JasonDX 30. Apr 2005 22:30

Re: If Text = 'Heute*irgendwas*' then ?
 
das mit 'Ha*lo' dürfte so gehen (ist aber ungetestet)
Delphi-Quellcode:
var
  buff: integer;

  buff := pos('Ha', Text);
  if (buff > 0) and (pos('lo', Text) > buff) then


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:17 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz