Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8944561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:03:14+00:00 2026-06-15T12:03:14+00:00

Note: I am using Delphi 7. Is there a way to split a string

  • 0

Note: I am using Delphi 7.

Is there a way to split a string by a line break?

I would like something like the following:

procedure Split
   (const Delimiter: Char;
    Input: string;
    const Strings: TStrings) ;
begin
   Assert(Assigned(Strings)) ;
   Strings.Clear;
   Strings.Delimiter := Delimiter;
   Strings.DelimitedText := Input;
end;

var
  xMSG:String;
  xStr:String;
  xStrList:TStrings;
  xLineBreak:String;
  xHello:String;
  xWorld:String;
begin
  xLineBreak := AnsiString(#13#10);
  xMSG := 'Hello ' + xLineBreak + 'World';
  xStrList := TStringList.Create;
  Split(xLineBreak,AnsiString(xMSG),xStrList);
  xHello := xStrList[0];
  xWorld := xStrList[1];
  MessageBox(0,PAnsiChar(xHello + xWorld),'Test',0);
end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:03:15+00:00Added an answer on June 15, 2026 at 12:03 pm

    Yes, this is what the Text property does. Quote from the help (Text property (TStrings)):

    Lists the strings in the TStrings object as a single string with the
    individual strings delimited by carriage returns and line feeds.

    Since it would be a one liner, you don’t need an additional utility procedure.

    var
      xMSG:String;
    //  xStr:String;
      xStrList:TStrings;
    //  xLineBreak:String;
      xHello:String;
      xWorld:String;
    begin
    //  xLineBreak := AnsiString(#13#10);     // you don't need this, there's sLineBreak
      xMSG := 'Hello ' + sLineBreak + 'World';
      xStrList := TStringList.Create;
    
    //  Split(xLineBreak,AnsiString(xMSG),xStrList);  
      xStrList.Text := xMSG;  // <--
    
      xHello := xStrList[0];
      xWorld := xStrList[1];
      xStrList.Free;
      MessageBox(0,PAnsiChar(xHello + xWorld),'Test',0);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found the following claim in the documentation for Net::OpenSSH : Note that using
[NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My
( Note : I'm using Scala 2.7.7 here, not 2.8). I'm doing something pretty
How do I make a TLabel behave like a hyperlink in Delphi? Note: I'm
I'm using Delphi 2007 and I wonder how the following problem can be solved:
Note: I am using Delphi XE2 I am trying to add a registry key.
Note: Using Monotouch. I have a directory called Images where I have all my
Note: I'm using Windows file servers and .NET If I were to create a
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
NOTE: I'm using a BSD based system so if I remember correctly this means

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.