Solved

How to split a text string

Posted on 2012-03-26
5
445 Views
Last Modified: 2012-03-27
Hello

i need split a string text

Text = <text1>,<text2>,<text3>..

can split and return text by function

getText(1) = <text1>
getText(2) = <text2>
getText(3) = <text3>
0
Comment
Question by:XSoFTz
  • 3
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
Thommy earned 100 total points
ID: 37764727
Try this...

function GetText(const aDelimiter: Char;Input: string;idx:integer):string;
var
  sl: TStringlist;
begin
   sl:=TStringList.Create;
   sl.Delimiter:=aDelimiter;
   sl.DelimitedText:=Input;
   result:=sl[idx-1];
   sl.Clear;
   sl.free;
end;

Open in new window


...
GetText(',','Text1,Text2,Text3',2) = 'Text2'
0
 

Author Comment

by:XSoFTz
ID: 37771555
i problem i need return type to double ?

how to fix it ?
0
 
LVL 19

Expert Comment

by:Thommy
ID: 37771581
Can you please explain more detailled what you intend to do???
0
 

Author Comment

by:XSoFTz
ID: 37771618
can coding return to double or

can convert string to double ?
0
 
LVL 19

Expert Comment

by:Thommy
ID: 37771683
string conversion to double is only possible when string value is a floating point number representation!!!

You can convert such strings using Delphi function Val() or FloatToStr()...

Please post a new question for more help!!!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

8 Experts available now in Live!

Get 1:1 Help Now