Javascript Programming Tips & Tricks

Español Français 中文 Deutsch Portuguese Japanese nederlands
Code Snippets
 List All
 Add Snippets
 Alerts & Prompts
 Array Methods
 Date & Time
 Error Handling
 Form Validation
 Image Effects
 Mathematical Functions
 Mouse Tricks
 String Functions
 Text Effects
 Window / User Info

strpos - Javascript

Snippets  Javascript  Strpos

Snippet On
strpos in javascript

Rate this page :
  [ 0 votes]

Find the occurrence of a string using strpos in javascript.

function strpos (haystack, needle, offset) {
var i = (haystack '').indexOf(needle, (offset || 0));
return i === -1 ? false : i;

call the function as,

var res='scripts,tutorials,tools';
strpos(res, ',');

result will be,

Other Links

web hosting