[Solved] convert this php code to javascript – strpos, str_replace, substr [closed]
Use the search() method of the string object – it returns the position of the match, or -1 if no match is found var position = -1, oldFlipBookThumb; var str=”<?php echo $video[“thumbs’][‘master’];?>’; if(str.search(“/thumbs_old/” != -1){ position = str.search(“.flv”); } if(position != -1){ oldFlipBookThumb = str.replace(str.substring(position, Number(position) + 4), ‘.flv’); } I could be mistaken, but … Read more