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

地理位置解析出错 #1

Open
Lin-H opened this issue Oct 11, 2014 · 1 comment
Open

地理位置解析出错 #1

Lin-H opened this issue Oct 11, 2014 · 1 comment

Comments

@Lin-H
Copy link

Lin-H commented Oct 11, 2014

在获取微博时的地理位置解析出错
在Status.java文件中

private void getGeoInfo(String geo) {
    StringBuffer value = new StringBuffer();
    for (char c : geo.toCharArray()) {
        if (c > 45 && c < 58) {
        value.append(c);
        }
        if (c == 44) {
        if (value.length() > 0) {
            latitude = Double.parseDouble(value.toString());
            value.delete(0, value.length());
        }
        }
    }
    longitude = Double.parseDouble(value.toString());
    }

修改为

 if (c == 44) {
        if (value.length() > 0 && latitude == -1) {
            latitude = Double.parseDouble(value.toString());
            value.delete(0, value.length());
        }
@HenryNebula
Copy link

Perhaps using regular expression is better i think..

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