1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2007-2008 - INRIA
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- JVM NOT MANDATORY -->
//==============================================================================
str = "Madam,in Eden I''m Adam ";
str_clean = strsubst(str,' ','');
str_clean = strsubst(str_clean,',','');
str_clean = strsubst(str_clean,'''','');
str_clean = convstr(str_clean,'l');
r = strrev(str_clean);
if r<>str_clean then bugmes();quit;end
//==============================================================================
str = "la mere gide digere mal";
str_without_blanks = strsubst(str,' ','');
r = strrev(str_without_blanks);
if r<>str_without_blanks then bugmes();quit;end
//==============================================================================
str = "a man, a plan, a canal : panama";
str_clean = strsubst(str,' ','');
str_clean = strsubst(str_clean,',','');
str_clean = strsubst(str_clean,':','');
r = strrev(str_clean);
if r<>str_clean then bugmes();quit;end
//==============================================================================
s = strrev('');
if s <> '' then bugmes();quit;end
//==============================================================================
str1 = "Madam,in Eden I''m Adam";
str2 = "la mere gide digere mal";
str3 = "a man, a plan, a canal : panama";
str1_rev = "madA m''I nedE ni,madaM";
str2_rev = "lam eregid edig erem al";
str3_rev = "amanap : lanac a ,nalp a ,nam a";
if strrev(str1) <> str1_rev then bugmes();quit;end
if strrev(str2) <> str2_rev then bugmes();quit;end
if strrev(str3) <> str3_rev then bugmes();quit;end
if strrev(str1_rev) <> str1 then bugmes();quit;end
if strrev(str2_rev) <> str2 then bugmes();quit;end
if strrev(str3_rev) <> str3 then bugmes();quit;end
//=================
str_test = [ str1 str2 str3 ];
str_test_rev = [ str1_rev str2_rev str3_rev ];
if strrev(str_test) <> str_test_rev then bugmes();quit;end
if strrev(str_test) <> [ str1_rev str2_rev str3_rev ] then bugmes();quit;end
if strrev(str_test) <> [ strrev(str1) strrev(str2) strrev(str3) ] then bugmes();quit;end
//=================
str_test = [ str1 ; str2 ; str3 ];
str_test_rev = [ str1_rev ; str2_rev ; str3_rev ];
if strrev(str_test) <> str_test_rev then bugmes();quit;end
if strrev(str_test) <> [ str1_rev ; str2_rev ; str3_rev ] then bugmes();quit;end
if strrev(str_test) <> [ strrev(str1) ; strrev(str2) ; strrev(str3) ] then bugmes();quit;end
//=================
str_test = [ str1 str2 ; str3 str1 ];
str_test_rev = [ str1_rev str2_rev ; str3_rev str1_rev ];
if strrev(str_test) <> str_test_rev then bugmes();quit;end
if strrev(str_test) <> [ str1_rev str2_rev ; str3_rev str1_rev ] then bugmes();quit;end
if strrev(str_test) <> [ strrev(str1) strrev(str2) ; strrev(str3) strrev(str1) ] then bugmes();quit;end
|