Solved

How to split a text string

Posted on 2012-03-26
5
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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