Advertisement
Lusien_Lashans

rude

Apr 17th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     WSH.echo('Type string');
  2.      str = WScript.StdIn.ReadLine();
  3.  
  4.     WSH.echo('Type substring');
  5.      subStr = WScript.StdIn.ReadLine();
  6.     arr = new Array;
  7.     k = 0;
  8.     if (str === '' || subStr === ''){
  9.         WSH.echo('Wrong input strings');
  10.     }
  11.  
  12.     if (str.length < subStr.length){
  13.         WSH.echo('Wrong input substring')
  14.     }
  15.  
  16.     for ( i = 0; i < str.length - subStr.length + 1; i++){
  17.          j = 0;
  18.  
  19.         while(str.charAt(i + j) === subStr.charAt(j)){
  20.             j++;
  21.  
  22.             if (j === subStr.length){
  23.                 //WSH.echo(i+1);
  24.                 arr[k] = i+1;
  25.                 k++;
  26.                 break;
  27.             }
  28.         }
  29.     }
  30.     for(i=0; i<arr.length; i++)
  31.     {
  32.         WSH.echo(arr[i]);      
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement