Results 1 to 4 of 4
  1. #1
    vasu.sln is offline Member
    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Default how to split the value/string

    Hi Experts,

    can you share the sample code to split the input value based on the count.

    My requirement is, if source system send a field data with 550 characters, i need to split it to the 50 characters and make it as 550/50 =11 sub string values.
    Please let me know how to achieve in java code.

    Thanks in Advance
    Regards,
    saran

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,337
    Blog Entries
    7
    Rep Power
    20

    Default Re: how to split the value/string

    Have a look at the String.substring( ... ) method.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    vasu.sln is offline Member
    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Default Re: how to split the value/string

    Hi Jos,

    Thanks for the Quick reply. as i am new to Java, i am bale to do split the data to one level ,means first 50 characters.
    can you please share the code to achieve my requirement.


    Thanks in advance.

    Regards,
    saran

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,337
    Blog Entries
    7
    Rep Power
    20

    Default Re: how to split the value/string

    C'mon now: you want 11 Strings, each of length 50; you have to chop up your original String into 11 pieces; piece #i starts at position 50*i and ends at position 50*i+50.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Split string
    By codeAJ in forum New To Java
    Replies: 14
    Last Post: 05-08-2011, 10:51 AM
  2. Split a String with split()--Help
    By danilson in forum New To Java
    Replies: 7
    Last Post: 11-19-2010, 04:08 PM
  3. String split
    By soccer_kid_6 in forum New To Java
    Replies: 3
    Last Post: 10-29-2010, 07:51 PM
  4. How to split a String using split function
    By Java Tip in forum java.lang
    Replies: 4
    Last Post: 04-17-2009, 08:27 PM
  5. How to split a String using split function
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:32 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
  •