Determine if a string has all the same characters: Difference between revisions
Content added Content deleted
(Added S-BASIC example) |
(→{{header|S-BASIC}}: revamp output display) |
||
Line 3,514: | Line 3,514: | ||
end = result |
end = result |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
report "" |
|||
while 1 = 1 do |
|||
report " " |
|||
begin |
|||
report "2" |
|||
rem - ^C at prompt will end program |
|||
report "333" |
|||
input "string to test: "; str |
|||
report ".55" |
|||
⚫ | |||
report "tttTTT" |
|||
⚫ | |||
report "4444 444k" |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
Line 3,538: | Line 3,541: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
string |
Test string "" has length = 0 |
||
The test string "" has length = 0 |
|||
The characters are all the same |
The characters are all the same |
||
string |
Test string " " has length = 0 |
||
The test string " " has length = 0 |
|||
The characters are all the same |
The characters are all the same |
||
string |
Test string "2" has length = 1 |
||
The test string "2" has length = 1 |
|||
The characters are all the same |
The characters are all the same |
||
string |
Test string "333" has length = 3 |
||
The test string "333" has length = 3 |
|||
The characters are all the same |
The characters are all the same |
||
string |
Test string ".55" has length = 3 |
||
⚫ | |||
The test string ".55" has length = 3 |
|||
⚫ | |||
string |
Test string "tttTTT" has length = 6 |
||
⚫ | |||
The test string "tttTTT" has length = 6 |
|||
⚫ | |||
string |
Test string "4444 444k" has length = 9 |
||
⚫ | |||
The test string "4444 444k" has length = 10 |
|||
⚫ | |||
</pre> |
</pre> |
||
=={{header|Scala}}== |
=={{header|Scala}}== |