BrU32

JS cutStrMid Function for string manpulation example

Aug 7th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. <script>
  2.  
  3. var p =cutStrMid("enter string here!!!!!",null,null,2,5);//Returns "en".
  4.  
  5. document.writeln(p);//prints out the extracted string from the above line.
  6.  
  7. function cutStrMid(s,len,left,right){
  8.  
  9. var s1="";
  10.  
  11. var s2="";
  12.  
  13. s1=s.substring(s,right);
  14.  
  15. s2-s.substring(s.length-right,s.length);
  16.  
  17. return(s1+ ""+s2);
  18.  
  19. }
  20.  
  21. </script>
Advertisement
Add Comment
Please, Sign In to add comment