BlackNerubia
New Member
- Reaction score
- 12
Ok, i was wondering if there was a easy way to make a trigger count the Characters in a string and check for spaces?
Display String Length
Events
Player - Player 1 (Red) types a chat message containing Empty String as A substring
[COLOR="red"]//* to detect if the player types [U]anything[/U] in chat[/COLOR]
Conditions
Actions
[COLOR="red"]//* this would be the normal length of the string[/COLOR]
Game - Display to (All players) the text: (Entered String Length: + (String((Length of (Entered chat string)))))
[COLOR="Red"]//* ---- this part to count string length without spaces[/COLOR]
Set i = 0
For each (Integer A) from 1 to (Length of (Entered chat string)), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), (Integer A), (Integer A))) Not equal to [COLOR="Red"]//*enter a space here[/COLOR]
Then - Actions
Set i = (i + 1)
Else - Actions
Game - Display to (All players) the text: (Entered String Length without spaces: + (String(i)))
[COLOR="Red"]//* the integer variable "i" would have now stored the string length without spaces[/COLOR]