Solved

Parsing Strings

Posted on 1997-05-18
3
275 Views
Last Modified: 2012-05-04
Hi I'm new to Delphi

Can you tell me how to break apart the following string into 3 components

Modem Name, Delimeter, Modem stirng

where the original string is in the form

USR-14.4 - AT&F

Component 1 is variable in my list of strings and is"USR-14.4" in this expample

Component 2 is the delimeter and is " - " (space comma space) and is always the same.

Component 3 is the Modem Init string "AT&F' in this example and is also variable in the list of strings

I need to get just component 3 for writing to another part of my program

Thanks for the help

Chris
0
Comment
Question by:chrisj051697
  • 2
3 Comments
 

Author Comment

by:chrisj051697
ID: 1336427
Edited text of question
0
 
LVL 1

Accepted Solution

by:
sleach earned 50 total points
ID: 1336428
var
ModemString, ModemName, Delimiter, Data:  string;
begin
{initialize data & delimiter}
Data := 'USR-14.4 - AT&F';
Delimiter := ' - ';

ModemName := copy(data, 1, pos(delimiter, data)-1);
ModemString := copy(data, pos(delimiter, data)+3, length(data));
end;

0
 

Author Comment

by:chrisj051697
ID: 1336429
Thanks Again
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

Suggested Solutions

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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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