Breaking huge text into multiple parts.Please help..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waNnY
    New Member
    • Feb 2008
    • 1

    Breaking huge text into multiple parts.Please help..

    Hi all..i'm urgently need any attention here..pliz help to solve this problem..
    The description of my problem is like dis >> let say now i have 100 length of a text. Now , i need to break it into multiple parts, accordingly to the max lenght of a part for one time is 30.So, it should be to returned like dis >>
    text [1]="blablabla. ." -->text.length =30
    text [2]="blablabla. ." -->text.length =30
    text [3]="blablabla. ." -->text.length =30
    text [4]="blablabla. ." -->text.length =10

    I have write a pieces of code that may explain what i try to do..but its not really work..i hope anybody out there can help me..thanks a lot..

    code:
    for (int i=0; i<fullMsg.lengt h(); i++){
    singlLen ++;
    }

    if (singlLen == LEN-1){

    System.out.prin t("splitMsg: i="+i+"\n");
    System.out.prin t("splitting new msg["+msgCnt+"]="+fullMsg.subs tring(beginPos, i)+"\n");

    msg[msgCnt] = fullMsg.substri ng(beginPos, i);
    singlLen = 0;
    msgCnt ++;
    beginPos = i+1;
    }
  • jx2
    New Member
    • Feb 2007
    • 228

    #2
    you need this
    read method allow to read specify number of bytes
    regards
    jx2

    Comment

    • jx2
      New Member
      • Feb 2007
      • 228

      #3
      or you can try
      this:
      [code=java]
      String bigStr = "your big Str....";
      String [10] strings;
      strings[0] = bigStr.substrin g(0,30);
      strings[1] = bigStr.substrin g(30,60);
      [/code]

      Comment

      Working...