getTimeYi static method

List<String> getTimeYi(
  1. String dayGanZhi,
  2. String timeGanZhi
)

Implementation

static List<String> getTimeYi(String dayGanZhi, String timeGanZhi) {
  List<String> l = <String>[];
  String day = hex(getJiaZiIndex(dayGanZhi));
  String time = hex(getJiaZiIndex(timeGanZhi));
  int index = TIME_YI_JI.indexOf(day + time + '=');
  if (index > -1) {
    String left = TIME_YI_JI.substring(index + 5);
    if (left.contains('=')) {
      left = left.substring(0, left.indexOf('=') - 4);
    }
    String ys = left.substring(0, left.indexOf(','));
    for (int i = 0, j = ys.length; i < j; i += 2) {
      l.add(YI_JI[int.parse(ys.substring(i, i + 2), radix: 16)]);
    }
  }
  if (l.isEmpty) {
    l.add('无');
  }
  return l;
}