Results 1 to 2 of 2
  1. #1
    trkece is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default How to read file line by line with fixed number of characters

    Hi all,

    I want to read line by line with fixed number of characters like

    file contains
    " lhjugtryyr
    ghjjkklyu gftytjuujtyyuyy
    rtriuyiiuyjv yhtuyiu yyuyiu fghtryyiukigdfsnmvv mrtkjtrk
    hfdgruiuouoiujjvjb rot uyoth ertewpoyu iuoreworu 9yo
    rertryuyuiy rewttruityouj eryotruioj tettryuyu
    ryrutyiu eyruti ytyutiui tryuitye
    erewtyruti ytrryui uyui6ryyrurbyuyiey

    in this i want to read with 10 character at a time, if the 10th character is the end of line then i want to take total line
    if the 10th character is in between the line, i want to skip the cuurent line and it has to take up to the previous line ...........

    1) it has to take total line otherwise it has to leave ........
    2) with fixed characters ..

  2. #2
    TheEnemy is offline Member
    Join Date
    Feb 2011
    Rep Power


    I think using the substring function (from the String class) would get this done. Have you tried it?

Similar Threads

  1. How to read a fixed number of bytes in a DataInputStream
    By Michailangelo in forum Networking
    Replies: 4
    Last Post: 06-29-2010, 02:13 AM
  2. Replies: 1
    Last Post: 10-08-2009, 04:45 PM
  3. Replies: 4
    Last Post: 09-10-2009, 10:18 AM
  4. Log4j not printing out file and line number
    By devin in forum Java Servlet
    Replies: 2
    Last Post: 03-05-2009, 03:16 PM
  5. read the file from different line number
    By vaskarbasak in forum Advanced Java
    Replies: 3
    Last Post: 06-02-2008, 01:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts