Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
CheckSame:=proc(s)
|
||||
local i, index;
|
||||
printf("input: \"%s\", length: %a\n", s, StringTools:-Length(s));
|
||||
for i from 2 to StringTools:-Length(s) do
|
||||
if (s[i - 1] <> s[i]) then
|
||||
printf("The given string has different characters.\n");
|
||||
printf("The first different character is %a (0x%x) which appears at index %a.\n\n",
|
||||
s[i], convert(s[i], 'bytes')[1], i);
|
||||
return;
|
||||
end if;
|
||||
end do;
|
||||
# if no difference found
|
||||
printf("The given string has all same characters.\n\n");
|
||||
end proc:
|
||||
|
||||
# Test
|
||||
CheckSame("");
|
||||
CheckSame(" ");
|
||||
CheckSame("2");
|
||||
CheckSame("333");
|
||||
CheckSame(".55");
|
||||
CheckSame("tttTTT");
|
||||
CheckSame("4444 444k");
|
||||
Loading…
Add table
Add a link
Reference in a new issue