A string is a sequence of computer characters, including spaces. They can be of any length, though in certain circumstances they are limited to 10,240 characters, may include any character, and can be used in certain blocks, mainly found in the Operators section.
Below are some examples that express the theoretically infinite range of strings.
- A string
say [Hello world!]
- Addressing a user by their username
when green flag clicked say (join (join [Hi, ] (username)) [!])
- A string with a variable inside
when gf clicked if <(score) < (3) > then say ( join ( join [Your score was ] ( score ) ) [. Better luck next time!] ) else say ( join ( join [Your score was ] ( score ) ) [! Keep it up!] )
- The empty string or null string is a string with no characters
set [test v] to  // Empty set [test v] to ( join ( test ) [a] ) // Now test is "a"
Blocks that can Handle Strings
Several blocks use strings; below is a full list. Click on a block to learn more about it.
Reporter Blocks Involving Strings
Stack Blocks Involving Strings
say  for () secs
think  for () secs
ask  and wait
set [ v] to 
add  to [ v]
insert () at () of [ v]
replace item () of [ v] with ()
String or Number?
In Scratch, strings are casted into 0 when put into a number slot. This can only be done by using the
(item ( v) of [ v]) blocks. However, sometimes a string is not wanted in a number insert, such as in an OS clock. This is a simple script that detects whether or not something is a string or a number:
if < < ( ( reporter ) + ( 1 ) ) =  > and < not < ( reporter ) =  > > > then//Strings have a reporter value of 0 say [String!] else say [Number!] end
Alternatively, in Snap!, the block <is  a [number/text v]?> can be used.
All data a computer reads is encoded into binary code, or a series of "1"s and "0"s. Each individual "1" or "0" is known as a bit and 8 of these create a byte. Different sequences of bits and bytes resemble codes for different standardized letters. This is known as an encoding, or the uniform way of breaking down letters into sequences of numbers. Different encodings use different amounts of bits for each letter, and it all depends on how many characters would be available for a single, uniform encoding.
In Scratch, a string is simply a series of encoded letters that is parsed with a particular decoder. A string of text is read by the computer as plain text as opposed to compiled code for the instructions to a central processing unit.
Although the maximum length of a string is not known, it is noteworthy that strings are limited in length when using the
(join  ) block, which can return a string with at most 10240 characters. This is a feature only of the join block — strings can be longer than 100 million characters if need be. The actual limit is not yet known, but is likely only limited by the memory space of the running computer.
- String (computer science) on Wikipedia