valuesInStr method

List<List<int>> valuesInStr(
  1. List<Map<String, String>> _inlM,
  2. String _inS1,
  3. dynamic _inS2
)

Copied schema from shower.dart highValue List. Demand number 0-9 to be in formats: X:N, T:7 U:5 aso. Find 2 int in Strings like: V:3 E:7 > 3, 7 Map value: 'January x-plan is for V:3 and that demands E:7 to complete.'

Implementation

List<List<int>> valuesInStr(
    List<Map<String, String>> _inlM, String _inS1, _inS2) {
  List<List<int>> _retL = [];
  for (var x = 0; x < _inlM.length; x++) {
    for (var y in _inlM[x].keys) {
      //  howTo NULL indexOf
      int _pos1 = _inlM[x][y]!.indexOf(_inS1); //  like 'V:'
      int _pos2 = _inlM[x][y]!.indexOf(_inS2); //  like 'E:'

      int val_1 = -1;
      int val_2 = -1;
      //  check if we got 2 numbers and act for it
      //  howTo NULL  new String
      //  String check = _inlM[x][y].substring(_pos1 + 2, _pos1 + 3);
      //  2 String fields for check
      String check1 = ''; //  make String instance
      //  OK with !
      check1 = _inlM[x][y]!.substring(_pos1 + 2, _pos1 + 3);

      if (tl.isNumber(check1)) {
        val_1 = int.parse(_inlM[x][y]!.substring(_pos1 + 2, _pos1 + 3));
      }
      //  hklTry: !
      String check2 = _inlM[x][y]!.substring(_pos2 + 2, _pos2 + 3);
      if (tl.isNumber(check2)) {
        val_2 = int.parse(_inlM[x][y]!.substring(_pos2 + 2, _pos2 + 3));
      }
      _retL.add([val_1, val_2]); //  like: 5, 4  /  -1, 3
    } //  --  for (var y in _inlM[x].keys)
  }
  return _retL; //  [1,3 ], [5,4], [6,4], [3,8], [9,5] ....
}