Zho:字串是否包含指定字符的检查

Using a 函式积木 in combination with an algorithm, one can quickly check if a particular 字串 passed in as an argument has a list of characters within it.

Programming
The following 程式 can be used to check the condition. The 变量 (condition) is evaluated to true of false depending on if the string has the particular characters. For this script, assume the following:
 * "condition" is a variable used to determine true or false (the return variable)
 * "i" is a variable used for iterating (moving form one character to another)
 * "matches" is a variable used to determine the amount of characters detected in the base string
 * "allLetters" is a list compiled of the characters being checked for; it is useful because lists have a built-in function for checking contained items

定義 check if (base) has (characters) 變數 [condition v] 設為 [false] 刪除第 (全部 v) 項 \( [allLetters v] \) 變數 [i v] 設為 (1) 重複 (字串長度\( (characters) \)) 次 新增項目 (字串中第 (i) 字\( (characters) \)) \( [allLetters v] \) 變數 [i v] 改變 (1) end // adds each letter to a list 變數 [i v] 設為 (1) 變數 [matches v] 設為 (0) 重複 (字串長度\( (base) \)) 次 如果 <清單 [allLetters v] 包含 (字串中第 (i) 字\( (base) \)) ?> 那麼 變數 [matches v] 改變 (1) end 變數 [i v] 改變 (1) end 如果 <(matches) = (清單 [allLetters v] 的項目數 :: list)> 那麼 變數 [condition v] 設為 [true] end

参见

 * 字串是否包含指定字串的检查 a similar script that requires the characters to be in order
 * 字串