@abaplint/runtime 2.3.106 → 2.3.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.find = void 0;
|
|
4
|
+
const throw_error_1 = require("../throw_error");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
function find(input) {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
7
|
-
|
|
7
|
+
var _a, _b, _c, _d, _e;
|
|
8
|
+
let val = typeof input.val === "string" ? input.val : input.val.get();
|
|
8
9
|
if (input.regex) {
|
|
9
10
|
const caseInput = typeof input.case === "string" ? input.case : (_a = input.case) === null || _a === void 0 ? void 0 : _a.get();
|
|
10
11
|
const regex = typeof input.regex === "string" ? input.regex : input.regex.get();
|
|
@@ -20,8 +21,30 @@ function find(input) {
|
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
23
|
const sub = typeof input.sub === "string" ? input.sub : (_c = input.sub) === null || _c === void 0 ? void 0 : _c.get();
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let off = typeof input.off === "number" ? input.off : ((_d = input.off) === null || _d === void 0 ? void 0 : _d.get()) || 0;
|
|
25
|
+
let occ = typeof input.occ === "number" ? input.occ : (_e = input.occ) === null || _e === void 0 ? void 0 : _e.get();
|
|
26
|
+
if (occ === 0) {
|
|
27
|
+
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
|
|
28
|
+
}
|
|
29
|
+
else if (occ === undefined) {
|
|
30
|
+
occ = 1;
|
|
31
|
+
}
|
|
32
|
+
let negative = false;
|
|
33
|
+
if (occ < 0) {
|
|
34
|
+
negative = true;
|
|
35
|
+
val = val.split("").reverse().join("");
|
|
36
|
+
occ = Math.abs(occ);
|
|
37
|
+
}
|
|
38
|
+
let found = -1;
|
|
39
|
+
for (let i = 0; i < occ; i++) {
|
|
40
|
+
found = val.indexOf(sub || "", off);
|
|
41
|
+
if (found > 0) {
|
|
42
|
+
off = off + found + 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (negative === true && found > 0) {
|
|
46
|
+
found = val.length - found - 1;
|
|
47
|
+
}
|
|
25
48
|
return new types_1.Integer().set(found);
|
|
26
49
|
}
|
|
27
50
|
}
|
package/build/src/builtin/sy.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.sy = new types_1.Structure({
|
|
|
8
8
|
datum: new types_1.Date(),
|
|
9
9
|
dbcnt: new types_1.Integer(),
|
|
10
10
|
fdpos: new types_1.Integer(),
|
|
11
|
+
host: new types_1.Character(32).set("localhost"),
|
|
11
12
|
index: new types_1.Integer(),
|
|
12
13
|
langu: new types_1.Character(1).set("E"),
|
|
13
14
|
mandt: new types_1.Character(3).set("123"),
|