getDayXiongSha static method

List<String> getDayXiongSha(
  1. int lunarMonth,
  2. String dayGanZhi
)

Implementation

static List<String> getDayXiongSha(int lunarMonth, String dayGanZhi) {
  List<String> l = <String>[];
  String day = hex(getJiaZiIndex(dayGanZhi));
  String month = ((lunarMonth).abs() & 0xFF).toRadixString(16).toUpperCase();
  int index = DAY_SHEN_SHA.indexOf(month + day + '=');
  if (index > -1) {
    String left = DAY_SHEN_SHA.substring(index + 4);
    if (left.contains('=')) {
      left = left.substring(0, left.indexOf('=') - 3);
    }
    String xs = left.substring(left.indexOf(',') + 1);
    for (int i = 0, j = xs.length; i < j; i += 2) {
      l.add(SHEN_SHA[int.parse(xs.substring(i, i + 2), radix: 16)]);
    }
  }
  if (l.isEmpty) {
    l.add('无');
  }
  return l;
}