@genexus/web-standard-functions
Version:
GeneXus JavaScript standard functions library for web generators
17 lines • 495 B
JavaScript
import { length } from "../text/length";
/**
* Return position for last pattern occurence. Search is done backguard
* @param {string} target
* @param {string} pattern
* @param {number} from
* @return number
*/
export const lastIndexOf = (target, pattern, from) => {
if (from === undefined) {
from = target.length;
}
if (from < 1 || from > length(target))
return 0;
return target.lastIndexOf(pattern, from - 1) + 1;
};
//# sourceMappingURL=lastIndexOf.js.map