UNPKG

@abaplint/runtime

Version:
39 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.substring_after = substring_after; const abap_regex_1 = require("../abap_regex"); const types_1 = require("../types"); const string_1 = require("../types/string"); function substring_after(input) { let val = typeof input.val === "string" ? input.val : input.val.get(); if (input.val instanceof types_1.Character) { val = input.val.getTrimEnd(); } let reg = ""; if (typeof input.regex === "string") { reg = input.regex; } else if (typeof input.pcre === "string") { reg = input.pcre; } else if (input?.regex) { reg = input.regex.get(); } else if (input?.pcre) { reg = input.pcre.get(); } else if (typeof input.sub === "string") { reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub); } else if (input?.sub) { reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub.get()); } const r = new RegExp(reg + "(.*)"); const res = val.match(r); let ret = ""; if (res && res[1]) { ret = res[1]; } return new string_1.String().set(ret); } //# sourceMappingURL=substring_after.js.map