StuffString - Programmers Heaven

Howdy, Stranger!

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

Categories

StuffString

[b][red]This message was edited by BobJames at 2003-10-26 7:16:50[/red][/b][hr]
Hello....please forgive my ignorance as I am a raw beginner....here is my question.

I would like to be able to stuff string1 into string2 like this

[code]
this is str1
and this is str2

{and end up with this}

[this]and th[is]is is str[str1]2
[/code]

Any help would be nice.

Bob


Comments

  • zibadianzibadian Posts: 6,349Member
    : [b][red]This message was edited by BobJames at 2003-10-26 7:16:50[/red][/b][hr]
    : Hello....please forgive my ignorance as I am a raw beginner....here is my question.
    :
    : I would like to be able to stuff string1 into string2 like this
    :
    : [code]
    : this is str1
    : and this is str2
    :
    : {and end up with this}
    :
    : [this]and th[is]is is str[str1]2
    : [/code]
    :
    : Any help would be nice.
    :
    : Bob
    :
    For this you need to use the Insert() function. The code should look something like this (currently no Delphi on the computer).
    [code]
    for i := Length(string1) downto 1 do
    // loop backwards through the string to stuff
    if string1[i] <> ' ' then
    // if anything else than a space
    string2 := Insert(string1[i], string2); < i'm not sure about this like. You need to check the syntax in the help files.
    // stuff it into the other string.
    [/code]
Sign In or Register to comment.