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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:35:28+00:00 2026-06-11T14:35:28+00:00

How do I know the actual line number on file associated to a line

  • 0

How do I know the actual line number on file associated to a line read by the CSVReader class? I can count the lines assuming every line read by this class is a new line on file. The problem is that it is possible to have newline characters in the CSV file. So for example, having 3 “logical” lines does not mean we have 3 “physical” lines on file. I have an error reporting feature that almost always report the wrong line number because of this.

Any ideas how to determine the real line number on file? Thanks!

  • 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-11T14:35:29+00:00Added an answer on June 11, 2026 at 2:35 pm

    If you are willing to modify the source code, you can add a counter to

    private String getNextLine()
    

    Increment the counter in the two places where

    br.readLine();
    

    is called, and expose the counter as a public property.

    If you do not wish to modify the source code, for each CSV line returned, you could increment your own counter by 1 + the sum of the newline characters in the CSV line (presumably OpenCSV is returning columns including the newline characters to your code, though I have not tested that behavior). If you had Column A with one newline and Column B with two newlines, the actual file should look something like:

    “This is

    Cell A”,”And

    Cell

    B”

    resulting in 3 newline characters (or \r\n sequences, depending on your platform), plus the 1 line returned by OpenCSV. Increment your counter by 4.

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

Sidebar

Related Questions

I know in an actual query, you can use auto_increment=1 but how is this
I know that bash -x script.sh will execute script printing each line before actual
Here is the actual line of code I'm looking at: ContentVersionCache cvc = ((PageBase)this.Page).cache;
I am writing to a Graphics object dynamically and don't know the actual size
Bit of a bizarre question, but does anyone know the actual limit to the
I just want to know what is the actual difference between private and protected
Does anyone know if google geolocation feature/api makes an actual request to server even
As I know in C , passing of actual parameters of a function evaluation
I would like to know if there is any way to find the actual
I know I'm missing something here. In the XSLT transformation below, the actual result

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.