@genexus/web-standard-functions
Version:
GeneXus JavaScript standard functions library for web generators
14 lines • 391 B
JavaScript
import { length } from "./length";
/**
* Return position for first pattern occurence.
* @param {string} target
* @param {string} pattern
* @param {number} from
* @return number
*/
export const indexOf = (target, pattern, from = 1) => {
if (from < 1 || from > length(target))
return 0;
return target.indexOf(pattern, from - 1) + 1;
};
//# sourceMappingURL=indexOf.js.map