Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:17:23+00:00 2026-06-05T20:17:23+00:00

I have got this text file with latitude and longitude values of different points

  • 0

I have got this text file with latitude and longitude values of different points on a map.

How can I split my string into latitudes and longitudes? What is the general way to do these type of things that is with other delimiters like space or tab etc.?
Sample file:

28.515046280572285,77.38258838653564
28.51430151808072,77.38336086273193
28.513566177802456,77.38413333892822
28.512830832397192,77.38490581512451
28.51208605426073,77.3856782913208
28.511341270865113,77.38645076751709

This is the code I am using to read from the file:

try(BufferedReader in = new BufferedReader(new FileReader("C:\\test.txt"))) {
    String str;
    while ((str = in.readLine()) != null) {
        System.out.println(str);
    }
}
catch (IOException e) {
    System.out.println("File Read Error");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:17:24+00:00Added an answer on June 5, 2026 at 8:17 pm

    You may use the String.split() method:

    String[] tokens = str.split(",");
    

    After that, use Double.parseDouble() method to parse the string value to a double.

    double latitude = Double.parseDouble(tokens[0]);
    double longitude = Double.parseDouble(tokens[1]);
    

    Similar parse methods exist in the other wrapper classes as well – Integer, Boolean, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got code like this: BufferedReader in = new BufferedReader(new FileReader(C:\file.txt)); String text
I' ve got a problem with Haskell. I have text file looking like this:
I have a text like: I've got a date with this fellow tomorrow. Well
i have got a text file. there are names on every lines. here is
I have a text file like this: 11 2 3 4 11 111 Using
I have a list of IDs in a text file like this: 24641985 ,
Im new to this, but have got a generation script to ics file, to
I got text file with information: (100;200;first) .Can anybody tell me how to seperate
I have a text file similar to this on a remote device: D0-23-DB-31-04-3E%20192.168.4.42%20dnat 68-A8-6D-0C-38-B2%20192.168.4.40%20dnat
I have got one specific file like this: + + %3)+Lorem + + %4)+Lorem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.