Discuss Scratch

rdococ
Scratcher
1000+ posts

More String Operators

Scratch is a bit lacking in the string (that is, a sequence of letters and symbols, like a word or sentence) operators department, so I decided that I would suggest some blocks to do with strings.

// Strings in general
(letters (3) to (5) of [hello] :: operators) // this one has been suggested before, but I want to include it anyway.
(replace letter (3) of [healo] with [l] :: operators)
(replace letters (3) to (5) of [heard] with [llo] :: operators)

// Words in strings
(word (2) of [hello world!] :: operators)
(words (2) to (3) of [I am a banana.] :: operators)
(replace word (2) of [hello banana] with [world] :: operators)
(replace words (2) to (3) of [I am a banana.] with [was not a] :: operators)
(number of words in [I am a banana] :: operators)

Last edited by rdococ (Oct. 27, 2018 01:30:33)

miniepicness
Scratcher
1000+ posts

More String Operators

rdococ wrote:

(number of words in [I am a banana] :: operators)
What does a word count as?
SharksAreFish
Scratcher
30 posts

More String Operators

miniepicness wrote:

rdococ wrote:

(number of words in [I am a banana] :: operators)
What does a word count as?
I would assume anything separated by a space.

Powered by DjangoBB