To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 7915
7914  |  7916
Subject: 
Re: Delphi Help Needed: Converting string to TStringList?
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 1 Oct 2002 18:10:27 GMT
Viewed: 
746 times
  
"Tore Eriksson" <tore.eriksson@mbox325.swipnet.se> skrev i meddelandet
news:H3B9uK.Jo6@lugnet.com...

strCompleteText: String;
MyStringList: TStringList;

How do I convert strCompleteText (containing LF's) into strings in
MyStringList?

MyStringList.Text := strCompleteText;

As long as you want one element in MyStringList for each LF-separated string
in strCompleteText, and nothing else.

The other way around (which I presume you've found?) is:

strCompleteText := MyStringList.Text;

While you're at it, read the help (or the source if you have it) on
TStringList.CommaText too, it can be very useful for quick and dirty
parsing, especially if you have Delphi 6 or later.

BTW, if you have the Delphi VCL source, take a look at SYSUTILS.PAS, there
are quite a lot of useful procedures and functions which are not documented
in the help.

Or look at 'HyperString' (can't remember the URL), it's a gigantic string
library, with quite fast routines.

As for really fast parsing, look at the SynEdit (mwEdit) code for syntax
highlighting - it's a bit tricky to understand, but it's _fast_
--
Anders Isaksson, Sweden
BlockCAD:  http://user.tninet.se/~hbh828t/proglego.htm
Gallery:   http://user.tninet.se/~hbh828t/gallery/index.htm



Message has 1 Reply:
  Re: Delphi Help Needed: Converting string to TStringList?
 
(...) D'ooooh, I tried MyStringList.Add(str...leteText); and had all strCompleteText in MyStringList.Strings[0]! Now it works. Thanks a lot! /Tore (22 years ago, 1-Oct-02, to lugnet.cad.dev)

Message is in Reply To:
  Delphi Help Needed: Converting string to TStringList?
 
Hi! strCompleteText: String; MyStringList: TStringList; How do I convert strCompleteText (containing LF's) into strings in MyStringList? (The other way is quite simple.) TIA, /Tore (22 years ago, 1-Oct-02, to lugnet.cad.dev)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR