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 6210087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:05:55+00:00 2026-05-24T06:05:55+00:00

The goal is to create a type called TURLString to be called as follows:

  • 0

The goal is to create a type called TURLString to be called as follows:

var
  newURl : TURLString;
begin

  newURL.Append('http://').Append('www.thehost.com').Append('path/on/server').Append('?');

  ...lots of app logic...

  newURL.AppendParam('name', 'value').Append('#').AppendParam('name', 'value');

  ...more params added...

  result := httpClient.Get(newURL);

end;

With TURLString defined like this (note its a record):

//from actual code used
TURLString = record
private
    FString : string;
public
    function Append(APart : string) : TURLString;
    function AppendParam(AParam, AValue : string) : TURLString;
end;

function TURLString.Append(APart: string) : TURLString;
begin
  FString := FString + APart;
  result := self;
end;

function TURLString.AppendParam(AParam, AValue: string): TURLString;
begin
  if (not Empty) then
    FString := FString + URL_AMB;
  FString := FString + AParam + '=' + AValue;
  result := self;
end;

When stepping through the fluid calls, the values are appended but when exiting they revert to the first string passed into the first append call and newURL is equal to ‘http://’ while debugging the append call you see ‘http://www.thehost.com/path/on/server?name=value#name=value’.

Is this concept possible with a record?

  • 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-05-24T06:05:56+00:00Added an answer on May 24, 2026 at 6:05 am

    If you use a value type like a record then you need to assign the final returned result to a variable:

    newURL := newURL.Append('http://').Append('www.thehost.com');
    

    If you use a reference type like a class instance, then you can use the syntax that you used in your question.

    The reference type approach treats the data type as mutable, whereas for value types you are best implementing an immutable data type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal To use a CREATE TYPE statement in HSQLDB 2.0.0 to create a user-defined
The end goal is to create a helper found at the end called show_status(contact,event).
Goal: to create a percentage column based off the values of calculated columns. Here's
Duplicate: PHP validation/regex for URL My goal is create a PHP regex for website
I am very new to Json and my goal to create the Json output
My goal is to create a canned email on my server and then send
My goal is to create a list from menu.bin. This is the func: pitem
My goal is to create an entry form (addnew.php) that will allow me to
my goal is to create a sort of Javascript library, if you could call
The goal is to create a mock class which behaves like a db resultset.

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.