1. doni49's Avatar
    Hi all,

    I am writing an app that needs to be able to read a CSV file. I've seen examples for reading a file--but I'm pretty sure these examples read the WHOLE FILE. Can someone help me understand how to break it up into individual lines? Like maybe an array of strings.

    I know how to use "split" to break up each line.

    TIA!
    10-18-09 12:17 AM
  2. ydaraishy's Avatar
    Use split, but since String.split is not in J2ME, use a combination of String.substring and String.indexOf.
    10-18-09 03:15 AM
  3. doni49's Avatar
    I get the concept of what you're saying. But what char am I searching for? What char represents a newline?

    Thanks!
    10-18-09 05:04 AM
  4. anon(5342392)'s Avatar
    I believe this is what your looking to do.

    Just copy the entire method sample, works perfectly!

    Livelink - Redirection
    10-18-09 07:31 AM
  5. doni49's Avatar
    Yes--that's what I'm looking to do, but I still need to know what to use as the delimiter to split it into individual lines.

    Thanks!

    Posted from my CrackBerry at wapforums.crackberry.com
    10-18-09 08:01 AM
  6. anon(5342392)'s Avatar
    the file format says it all, Comma Seperated Values (CSV) you are looking for commas BUT there are special cases at times!

    Have a read of this wikipedia article for more info! Comma-separated values - Wikipedia, the free encyclopedia
    10-18-09 08:04 AM
  7. doni49's Avatar
    Ok--I've continued to search and just found something that indicates a newline would be represented by one of the following:
    • \n
    • \r
    • \r\n


    Posted from my CrackBerry at wapforums.crackberry.com
    10-18-09 08:06 AM
LINK TO POST COPIED TO CLIPBOARD