Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WSH.echo('Type string');
- str = WScript.StdIn.ReadLine();
- WSH.echo('Type substring');
- subStr = WScript.StdIn.ReadLine();
- arr = new Array;
- k = 0;
- if (str === '' || subStr === ''){
- WSH.echo('Wrong input strings');
- }
- if (str.length < subStr.length){
- WSH.echo('Wrong input substring')
- }
- for ( i = 0; i < str.length - subStr.length + 1; i++){
- j = 0;
- while(str.charAt(i + j) === subStr.charAt(j)){
- j++;
- if (j === subStr.length){
- //WSH.echo(i+1);
- arr[k] = i+1;
- k++;
- break;
- }
- }
- }
- for(i=0; i<arr.length; i++)
- {
- WSH.echo(arr[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement