From Test-Scratch-Wiki

字串中第 () 字 ()
字串中第 (1) 字\( (詢問的答案) \)
類別 運算類積木
形狀 橢圓形積木
加入於 1.4

The Letter () of () 積木 is an 運算類積木 and a 橢圓形積木. The block reports the specified character of the given text. Even though the block says "letter", it will report all characters, including letters, numbers, symbols, and even spaces.


If a value must be read out from the middle of a text, this block will do the job.

Some common uses for the Letter () of () block:

  • In conjunction with the 詢問的答案 block to find something out about the answer
如果 <(字串中第 (1) 字\( (詢問的答案) \)) = [z]> 那麼 
  說出 [That's my favorite letter too!] (3) 秒

  說出 [Interesting.] (2) 秒
  • To find a number in the middle of a 字串 of text
如果 <清單 [numbers v] 包含 (字串中第 (n) 字\( (詢問的答案) \)) ?> 那麼 
  說出 [Number]
  說出 [Letter/punctuation]
  • To tell whether a certain letter in a string equals a certain value
如果 <(letter (testing) of (詢問的答案)) = [z]> 那麼 
  停止 [這個程式 v]


Some Scratch 修改版 have a block that lets users choose how many characters in a string to report. This is also wanted for Scratch.[1] It would be like this: (letters () through () of [])//category=operators

However, it can be replicated with the following code:

變數 [report v] 設為 []
變數 [count v] 設為 (first letter)
重複直到 <(count) = ((last letter) + (1))> 
  變數 [report v] 設為 (字串組合 (report) 和 (字串中第 (count) 字\( (text) \)))
  變數 [count v] 改變 (1)


— the version for 清單s


Cookies help us deliver our services. By using our services, you agree to our use of cookies.