put after

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

put after

Rick Harrison via use-livecode
Okay so if a field only has 1 word, and I state

put tWord after word 2 of me into me

Shouldn't that create a second word? It doesn't it simply appends tWord to the end of word 1.

Bob S



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
seems like it should.  In fact it should work with " into " also, but that
has the same behavior


On Mon, Sep 11, 2017 at 3:11 PM, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Okay so if a field only has 1 word, and I state
>
> put tWord after word 2 of me into me
>
> Shouldn't that create a second word? It doesn't it simply appends tWord to
> the end of word 1.
>
> Bob S
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Put "two" after word 1 of "word"

result: "wordtwo"

put "two" after word 2 of "word"

result: "wordtwo"

'after word' basically counts white space. eg, "word,word,word" is counted
as one word". "word                   word" with several spaces counts as
two words. "word         " still counts as one word. There is no word two
here so it will always append after the same as if it was 'after word 53'!

But when you use put x *after* word y of z *into* z, with z being "word", x
being "two" and y being 2, you are using after out of syntax because you
wouldn't use **after** and **into** in the same 'put' line

Sean Cole
*Pi Digital Productions Ltd*
'Don't try to think outside the box. Just remember the truth: There is no
box!'
'For then you realise it is not the box you are trying to look outside of,
but it is yourself!'

eMail Ts & Cs <http://pidigital.co.uk/emailTCs.rtf>   Pi Digital
Productions Ltd is a UK registered limited company, no. 5255609

On 11 September 2017 at 22:11, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Okay so if a field only has 1 word, and I state
>
> put tWord after word 2 of me into me
>
> Shouldn't that create a second word? It doesn't it simply appends tWord to
> the end of word 1.
>
> Bob S
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
It doesn’t change your question, but you don’t need ‘into me’ at the end each line

put "four" into word 1 of me

put space & "help" after word 1 of me



> On Sep 11, 2017, at 4:50 PM, Sean Cole (Pi) via use-livecode <[hidden email]> wrote:
>
> Put "two" after word 1 of "word"
>
> result: "wordtwo"
>
> put "two" after word 2 of "word"
>
> result: "wordtwo"
>
> 'after word' basically counts white space. eg, "word,word,word" is counted
> as one word". "word                   word" with several spaces counts as
> two words. "word         " still counts as one word. There is no word two
> here so it will always append after the same as if it was 'after word 53'!
>
> But when you use put x *after* word y of z *into* z, with z being "word", x
> being "two" and y being 2, you are using after out of syntax because you
> wouldn't use **after** and **into** in the same 'put' line
>
> Sean Cole
> *Pi Digital Productions Ltd*
> 'Don't try to think outside the box. Just remember the truth: There is no
> box!'
> 'For then you realise it is not the box you are trying to look outside of,
> but it is yourself!'
>
> eMail Ts & Cs <http://pidigital.co.uk/emailTCs.rtf>   Pi Digital
> Productions Ltd is a UK registered limited company, no. 5255609
>
> On 11 September 2017 at 22:11, Bob Sneidar via use-livecode <
> [hidden email]> wrote:
>
>> Okay so if a field only has 1 word, and I state
>>
>> put tWord after word 2 of me into me
>>
>> Shouldn't that create a second word? It doesn't it simply appends tWord to
>> the end of word 1.
>>
>> Bob S
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Actually that was a typo. Put tWord after word 2 of me is what I meant.

Bob S


> On Sep 11, 2017, at 14:11 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> put tWord after word 2 of me into me


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
Curiously then, you can have a string with 1 item, then put tWord into item 3 of tString, and it will happily create an empty item 2 so that there is an item 3 to put something into. ex.

put "test" into tString;put "test3" into item 3 of tString;put tString
produces: test,,test3

put "test" into tString;put "test3" into word 3 of tString;put tString
produces: testtest3

Doesn't that seem like an anomaly to anyone?

Bob S

.


> On Sep 11, 2017, at 15:05 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> Actually that was a typo. Put tWord after word 2 of me is what I meant.
>
> Bob S
>
>
>> On Sep 11, 2017, at 14:11 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>>
>> put tWord after word 2 of me into me
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
You already know this, but you can also put tWord after tContainer (or
after text of me) - no chunk expression needed.

Phil Davis


On 9/11/17 3:05 PM, Bob Sneidar via use-livecode wrote:

> Actually that was a typo. Put tWord after word 2 of me is what I meant.
>
> Bob S
>
>
>> On Sep 11, 2017, at 14:11 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>>
>> put tWord after word 2 of me into me
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

--
Phil Davis


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode

> On 12 Sep 2017, at 8:10 am, Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> put "test" into tString;put "test3" into word 3 of tString;put tString
> produces: testtest3
>
> Doesn't that seem like an anomaly to anyone?

Hmm… yes this should probably fail with an execution error I suspect as it’s impossible to do. Can you please report it.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
This is exactly what I'd expect as 'item' uses a delimiter. If you had
'space' as the delimiter you could then use:

set the itemdel to space; put "test" into tString; put "test3" into item 3
of tString; put tString
result: test  test3
(with 2 spaces between the two words)

now:
put the number of words in tString
result: 2

And this is still correct. Look at the definitions of item, word,

I would want LC to put "test3" directly after "test" even if I did for some
bizarre reason decide to put it after word 63556 of tString as this would
be expected behavior. I would not want it to throw back an error or place
several spaces between the two words.



Sean Cole
*Pi Digital Productions Ltd*
www.pidigital.co.uk
+44(1634)402193
+44(7702)116447
'Don't try to think outside the box. Just remember the truth: There is no
box!'
'For then you realise it is not the box you are trying to look outside of,
but it is yourself!'

eMail Ts & Cs <http://pidigital.co.uk/emailTCs.rtf>   Pi Digital
Productions Ltd is a UK registered limited company, no. 5255609

On 11 September 2017 at 23:10, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Curiously then, you can have a string with 1 item, then put tWord into
> item 3 of tString, and it will happily create an empty item 2 so that there
> is an item 3 to put something into. ex.
>
> put "test" into tString;put "test3" into item 3 of tString;put tString
> produces: test,,test3
>
> put "test" into tString;put "test3" into word 3 of tString;put tString
> produces: testtest3
>
> Doesn't that seem like an anomaly to anyone?
>
> Bob S
>
> .
>
>
> > On Sep 11, 2017, at 15:05 , Bob Sneidar via use-livecode <
> [hidden email]> wrote:
> >
> > Actually that was a typo. Put tWord after word 2 of me is what I meant.
> >
> > Bob S
> >
> >
> >> On Sep 11, 2017, at 14:11 , Bob Sneidar via use-livecode <
> [hidden email]> wrote:
> >>
> >> put tWord after word 2 of me into me
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Setting the itemdelimiter to space and using items instead of words would certainly work around it, thanks for that tip.

But by way of discussion, when we talk about string manipulation in this list/forum, and how words are "delimited" we actually use the word "delimiter" to talk about the spaces, with the one difference that there is no wordDelimiter property that we can change, while there is for lines and items, so that:

put "test" into tString;put "test3" into line 3 of tString;put tString
produces:
test

test3

As you would expect. I guess that means that spaces are the bastard children of the string manipulation world. :-)

I will file a report anyway as requested.

Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Think about it:

Items ate comma (a single character) delimited, so if a container
contains a single string (no commas) and you "put tString after item 3
of tContainer", LiveCode can logically create an "empty" item 2 and
empty item 3 using ",," and place (concatenate) tString on to the end of
empty item 3.

Words are whitespace (any whitespace) delimited, so if a container
contains a single string and you "put tString after word 3 of
tContainer", LiveCode can not create an empty word. If it tried 2
spaces, that is still a single whitespace delimiter for words. The only
choices are fail (execution error) or concatenate on to the end of the
last word it can find.

xTalk/LiveCode script tries to be a forgiving language from its
Hypercard roots and so it concatenates on to teh end of the last word it
can find.



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Because a word is defined as 'a number of characters together in a string
separated either or both sides by a white space'. So it doesn't actually
count the white spaces but the number of actual strings of characters
separated by them. The actual glossary term is not fully expressive by
saying "A chunk of text that is delimited by spaces, tabs, or returns."

Sean Cole
*Pi Digital Productions Ltd*
www.pidigital.co.uk
+44(1634)402193
+44(7702)116447
'Don't try to think outside the box. Just remember the truth: There is no
box!'
'For then you realise it is not the box you are trying to look outside of,
but it is yourself!'

eMail Ts & Cs <http://pidigital.co.uk/emailTCs.rtf>   Pi Digital
Productions Ltd is a UK registered limited company, no. 5255609

On 11 September 2017 at 23:36, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Setting the itemdelimiter to space and using items instead of words would
> certainly work around it, thanks for that tip.
>
> But by way of discussion, when we talk about string manipulation in this
> list/forum, and how words are "delimited" we actually use the word
> "delimiter" to talk about the spaces, with the one difference that there is
> no wordDelimiter property that we can change, while there is for lines and
> items, so that:
>
> put "test" into tString;put "test3" into line 3 of tString;put tString
> produces:
> test
>
> test3
>
> As you would expect. I guess that means that spaces are the bastard
> children of the string manipulation world. :-)
>
> I will file a report anyway as requested.
>
> Bob S
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Bob Sneidar wrote:

 > put tWord after word 2 of me
 >
 > Shouldn't that create a second word?

No.  It will append the string tWord after the chunk element specified
in the target expression, "word 2 of me".

It may be clearer to consider lines:

   put "Something" after line 2 of tContainer

With that you wouldn't expect it to create a new line, but to add
"Something" to the end of the specified line.

And so it is with other delimiters.

If you want to add a new chunk, you'll have to make that explicit:

   put tWord into word (the number of words of me + 1) of me

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
The point was that if there was no line 2 it would create one so that it had something to put after. Works with lines and items. Does not work with words, but as it was explained, though we use the term "delimited" when talking about words, it's a different animal.

Bob S


> On Sep 11, 2017, at 16:37 , Richard Gaskin via use-livecode <[hidden email]> wrote:
>
> With that you wouldn't expect it to create a new line, but to add "Something" to the end of the specified line.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: put after

Rick Harrison via use-livecode
Bob Sneidar wrote:

 >   put tWord after word 2 of me
...
 > The point was that if there was no line 2 it would create one so that
 > it had something to put after. Works with lines and items. Does not
 > work with words, but as it was explained, though we use the term
 > "delimited" when talking about words, it's a different animal.

Thanks.  I was thrown off by "after" - why use "after" if there is
nothing before?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode