Solved

Finding a string within another

Posted on 2001-07-11
2
140 Views
Last Modified: 2010-04-06
Just wondering, is there a method in Delphi whereby I can determine whether a string is in another.

Say I've got the string1 as "ask", and string2 as "ask a question in the delphi programming topic area", is there a command whether I can determine if "ask" is in the second string, or is this something I have to program manually...?

Thanks for the help
0
Comment
Question by:Lmoen
2 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 30 total points
ID: 6274756
You can use the Pos function. It returns the position of the first match:

Label1.Caption := IntToStr(Pos('ask', 'ask a question in the delphi programming topic area'));
0
 

Author Comment

by:Lmoen
ID: 6275707
Thanks for the help
Appreciated
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question