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