summaryrefslogtreecommitdiff
path: root/37/CH1/EX1.2/Solved2.sci
blob: 68a6255161062d8030881ba2f62b015bf20ee7e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Solved Example 2
//:String Manipulations
funcprot(0)
function[l]=strlen(str)
  i=1;
  l=0;
  [j,k]=size(str)
  for  i=1:k
    l=l+length(str(i));
  end
  disp(l,"string length is");
endfunction
//Calling Routine:
str="Hello World";
l=strlen(str)
function[c]=strcat1(a,b)
  disp(strcat([a b]),"After concatination");
  c=strcat([a b]);
endfunction
//Calling Routine:
a="hello ";
b="world";
c=strcat1(a,b);