diff options
author | Brijeshcr | 2017-07-07 19:57:00 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-07 19:57:00 +0530 |
commit | eb4fd4f84b56a9b8f1976a67461f2c918edede32 (patch) | |
tree | ad6032b0992e679f9d69e98074141267888f5c03 /tests/unit_tests/test_string/scilabcode/main.sci | |
parent | aa250753b439916e4df235839e9266f058632f80 (diff) | |
parent | 936bd00d2855553f52d682494814804065c7b99e (diff) | |
download | scilab2c-eb4fd4f84b56a9b8f1976a67461f2c918edede32.tar.gz scilab2c-eb4fd4f84b56a9b8f1976a67461f2c918edede32.tar.bz2 scilab2c-eb4fd4f84b56a9b8f1976a67461f2c918edede32.zip |
Signal Processing and Demos Updated
Diffstat (limited to 'tests/unit_tests/test_string/scilabcode/main.sci')
-rw-r--r-- | tests/unit_tests/test_string/scilabcode/main.sci | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit_tests/test_string/scilabcode/main.sci b/tests/unit_tests/test_string/scilabcode/main.sci new file mode 100644 index 00000000..4030ee09 --- /dev/null +++ b/tests/unit_tests/test_string/scilabcode/main.sci @@ -0,0 +1,30 @@ +//This is the demo function to test a set of string functions +// ascii->converts the input char vector/array to corresponding ascii code or vice versa +// strchr-> it finds the occurence of a charcter in a given string +// strncpy->copy charcters from string +// strspn-> get span of character set in string + +function main() + strascii1="ankit is raj"; //This is the input string for testing the function. + asciiout1=ascii(strascii1); //calling of the function + disp(asciiout1); + + strascii2=[97 98 99 100 101]; //Input as the ascii code to get converted to string + asciiout2=ascii(strascii2); //calling the function + disp(asciiout2); + + str="This is a sample string"; + ch="s"; + out1=strchr(str,ch); + disp(out1); + + ss="Ankit Raj"; + nn=5; + resu=strncpy(ss,nn); + disp(resu); + + strsample2="Hello this is Ankit"; + a="Ank"; + oup2=strspn(a,strsample2); + disp(oup2) +endfunction |