Solved

Parsing Strings

Posted on 1997-05-18
3
265 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
PDF library for Delphi 2 104
Delphi TcxGrid group footer summary 3 206
How to define IfThen functions in one common unit? 4 44
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Both in life and business – not all partnerships are created equal. Spend 30 short minutes with us to learn:   • Key questions to ask when considering a partnership to accelerate your business into the cloud • Pitfalls and mistakes other partners…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now