Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

旬空干支空了报错 #49

Open
xuxiaokang7511 opened this issue Jan 2, 2025 · 3 comments
Open

旬空干支空了报错 #49

xuxiaokang7511 opened this issue Jan 2, 2025 · 3 comments

Comments

@xuxiaokang7511
Copy link

protected static int getXunIndex(String ganZhi) {
    int ganIndex = find(ganZhi.substring(0, 1), GAN, 0);
    int zhiIndex = find(ganZhi.substring(1), ZHI, 0);
    int diff = ganIndex - zhiIndex;
    if (diff < 0) {
        diff += 12;
    }

    return diff / 2;
}

public static String getXun(String ganZhi) {
    return XUN[getXunIndex(ganZhi)];
}

public static String getXunKong(String ganZhi) {
    return XUN_KONG[getXunIndex(ganZhi)];
}

int ganIndex = find(ganZhi.substring(0, 1), GAN, 0); ganZhi空了会报错
@6tail
Copy link
Owner

6tail commented Jan 3, 2025

干支为什么会空呢

@xuxiaokang7511
Copy link
Author

大运开始的第一个数组干支是空的

@6tail
Copy link
Owner

6tail commented Jan 3, 2025

空的可以不调用噻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants