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 172803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:13:49+00:00 2026-05-11T13:13:49+00:00

There is about 2000 lines of this, so manually would probably take more work

  • 0

There is about 2000 lines of this, so manually would probably take more work than to figure out a way to do ths programatically. It only needs to work once so I’m not concerned with performance or anything.

<tr><td>Canada (CA)</td><td>Alberta (AB)</td></tr> <tr><td>Canada (CA)</td><td>British Columbia (BC)</td></tr> <tr><td>Canada (CA)</td><td>Manitoba (MB)</td></tr> 

Basically its formatted like this, and I need to divide it into 4 parts, Country Name, Country Abbreviation, Division Name and Division Abbreviation.

In keeping with my complete lack of efficiency I was planning just to do a string.Replace on the HTML tags after I broke them up and then just finding the index of the opening brackets and grabbing the space delimited strings that are remaining. Then I realized I have no way of keeping track of which is the country and which is the division, as well as figuring out how to group them by country.

So is there a better way to do this? Or better yet, an easier way to populate a database with Country and Provinces/States? I looked around SO and the only readily available databases I can find dont provide the full name of the countries or the provinces/states or use IPs instead of geographic names.

  • 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. 2026-05-11T13:13:50+00:00Added an answer on May 11, 2026 at 1:13 pm
    1. Paste it into a spreadsheet. Some spreadsheets will parse the HTML table for you.

    2. Save it as a .CSV file and process it that way. Or. Add a column to the spreadsheet that says something like the following:

      =’INSERT INTO COUNTRY(CODE,NAME) VALUES=(” & A1 & ”,” & B1 & ”);’

    Then you have a column of INSERT statements that you can cut, paste and execute.


    Edit

    Be sure to include the <table> tag when pasting into a spreadsheet.

    <table><tr><th>country</th><th>name></th></tr> <tr><td>Canada (CA)</td><td>Alberta (AB)</td></tr> <tr><td>Canada (CA)</td><td>British Columbia (BC)</td></tr> <tr><td>Canada (CA)</td><td>Manitoba (MB)</td></tr> </table> 

    Processing a CSV file requires almost no parsing. It’s got quotes and commas. Much easier to live with than XML/HTML.

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Turns out the bindings were incomplete. It is now fixed.… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer No; although Objective-C is a dynamically typed language, it is… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer vector::operator[] retrieves the Nth element of the vector. Such an… May 12, 2026 at 1:03 am

Related Questions

Im working on a program which moves a panel within a form. I use
I have a big doubt. Let's take as example a database for a whatever
I'm developing a LoB application in Java after a long absence from the platform
Is it really viable to use GCJ to publish server-side applications? Webapps? My boss

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.