String functions

Can any one help with this:

I have a long string that contain many values that seperated with ','.
How can i get these values in to array or some thing else with out the ','?

If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.

Thanks lee.

Comments

  • : Can any one help with this:
    :
    : I have a long string that contain many values that seperated with ','.
    : How can i get these values in to array or some thing else with out the ','?
    :
    : If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.
    :
    : Thanks lee.
    :
    Here is a simple code using the TStrings object:
    [code]
    var
    S: TStrings;
    begin
    S := TStringList.Create;
    try
    S.CommaText := MyString;
    // Use S as an array of strings.
    finally
    S.Free;
    end;
    end;
    [/code]
    The help files contain more info on the TStrings and TStringList objects.
  • : : Can any one help with this:
    : :
    : : I have a long string that contain many values that seperated with ','.
    : : How can i get these values in to array or some thing else with out the ','?
    : :
    : : If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.
    : :
    : : Thanks lee.
    : :
    : Here is a simple code using the TStrings object:
    : [code]
    : var
    : S: TStrings;
    : begin
    : S := TStringList.Create;
    : try
    : S.CommaText := MyString;
    : // Use S as an array of strings.
    : finally
    : S.Free;
    : end;
    : end;
    : [/code]
    : The help files contain more info on the TStrings and TStringList objects.
    :

    Hey your OK!!!!!!!!
    I have a little problem with the S.CommaText
    The values in between the comma's can contain spaces and the S.CommaText don't "like" it....
    Is there is another solutions for this?
    Lee

  • : : : Can any one help with this:
    : : :
    : : : I have a long string that contain many values that seperated with ','.
    : : : How can i get these values in to array or some thing else with out the ','?
    : : :
    : : : If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.
    : : :
    : : : Thanks lee.
    : : :
    : : Here is a simple code using the TStrings object:
    : : [code]
    : : var
    : : S: TStrings;
    : : begin
    : : S := TStringList.Create;
    : : try
    : : S.CommaText := MyString;
    : : // Use S as an array of strings.
    : : finally
    : : S.Free;
    : : end;
    : : end;
    : : [/code]
    : : The help files contain more info on the TStrings and TStringList objects.
    : :
    :
    : Hey your OK!!!!!!!!
    : I have a little problem with the S.CommaText
    : The values in between the comma's can contain spaces and the S.CommaText don't "like" it....
    : Is there is another solutions for this?
    : Lee
    :
    :
    I've written a function called StringSplit(), which can do pretty much the same thing. You can find it in the CodePedia.
  • : : : : Can any one help with this:
    : : : :
    : : : : I have a long string that contain many values that seperated with ','.
    : : : : How can i get these values in to array or some thing else with out the ','?
    : : : :
    : : : : If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.
    : : : :
    : : : : Thanks lee.
    : : : :
    : : : Here is a simple code using the TStrings object:
    : : : [code]
    : : : var
    : : : S: TStrings;
    : : : begin
    : : : S := TStringList.Create;
    : : : try
    : : : S.CommaText := MyString;
    : : : // Use S as an array of strings.
    : : : finally
    : : : S.Free;
    : : : end;
    : : : end;
    : : : [/code]
    : : : The help files contain more info on the TStrings and TStringList objects.
    : : :
    : :
    : : Hey your OK!!!!!!!!
    : : I have a little problem with the S.CommaText
    : : The values in between the comma's can contain spaces and the S.CommaText don't "like" it....
    : : Is there is another solutions for this?
    : : Lee
    : :
    : :
    : I've written a function called StringSplit(), which can do pretty much the same thing. You can find it in the CodePedia.
    :

    What is the CodePedia?

  • : : : : : Can any one help with this:
    : : : : :
    : : : : : I have a long string that contain many values that seperated with ','.
    : : : : : How can i get these values in to array or some thing else with out the ','?
    : : : : :
    : : : : : If you can add some code it will be greate if not just tell me the functions that i can use and i will try to figure it out.
    : : : : :
    : : : : : Thanks lee.
    : : : : :
    : : : : Here is a simple code using the TStrings object:
    : : : : [code]
    : : : : var
    : : : : S: TStrings;
    : : : : begin
    : : : : S := TStringList.Create;
    : : : : try
    : : : : S.CommaText := MyString;
    : : : : // Use S as an array of strings.
    : : : : finally
    : : : : S.Free;
    : : : : end;
    : : : : end;
    : : : : [/code]
    : : : : The help files contain more info on the TStrings and TStringList objects.
    : : : :
    : : :
    : : : Hey your OK!!!!!!!!
    : : : I have a little problem with the S.CommaText
    : : : The values in between the comma's can contain spaces and the S.CommaText don't "like" it....
    : : : Is there is another solutions for this?
    : : : Lee
    : : :
    : : :
    : : I've written a function called StringSplit(), which can do pretty much the same thing. You can find it in the CodePedia.
    : :
    :
    : What is the CodePedia?
    :
    :
    CodePedia is a brother-site of the programmersheaven. It is listed in the links above the search field, below the members box.
  • : : Here is a simple code using the TStrings object:
    : : [code]
    : : var
    : : S: TStrings;
    : : begin
    : : S := TStringList.Create;
    : : try
    : : S.CommaText := MyString;
    : : // Use S as an array of strings.
    : : finally
    : : S.Free;
    : : end;
    : : end;
    : : [/code]
    : : The help files contain more info on the TStrings and TStringList objects.
    : :


    If you are creating "MyString" yourself, then you want to write the all the values enclosed with quotes
    ( "Sample Word With Spaces","123.456","456.111","True" )
    this even takes are of words / phrases that have COMMAS embedded in them for example
    "Time, only time can tell"
    would be 1 field and not be split up into 2 fields


    If this is a Fixed Length record, you could even use the SCHEMA file and import using a ClientDataset (Schema file used to define the record layout)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories