Solved

How to split a text string

Posted on 2012-03-26
5
438 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
Comment Utility
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
Comment Utility
i problem i need return type to double ?

how to fix it ?
0
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
Can you please explain more detailled what you intend to do???
0
 

Author Comment

by:XSoFTz
Comment Utility
can coding return to double or

can convert string to double ?
0
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

12 Experts available now in Live!

Get 1:1 Help Now