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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:39:32+00:00 2026-05-15T03:39:32+00:00

I want to split string without using split . can anybody solve my problem

  • 0

I want to split string without using split . can anybody solve my problem I am tried but
I cannot find the exact logic.

  • 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-05-15T03:39:33+00:00Added an answer on May 15, 2026 at 3:39 am

    I’m going to assume that this is homework, so I will only give snippets as hints:

    Finding indices of all occurrences of a given substring

    Here’s an example of using indexOf with the fromIndex parameter to find all occurrences of a substring within a larger string:

    String text = "012ab567ab0123ab";
    
    // finding all occurrences forward: Method #1
    for (int i = text.indexOf("ab"); i != -1; i = text.indexOf("ab", i+1)) {
        System.out.println(i);
    } // prints "3", "8", "14"
    
    // finding all occurrences forward: Method #2
    for (int i = -1; (i = text.indexOf("ab", i+1)) != -1; ) {
        System.out.println(i);
    } // prints "3", "8", "14"
    

    String API links

    • int indexOf(String, int fromIndex)
      • Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. If no such occurrence exists, -1 is returned.

    Related questions

    • Searching for one string in another string

    Extracting substrings at given indices out of a string

    This snippet extracts substring at given indices out of a string and puts them into a List<String>:

    String text = "0123456789abcdefghij";
    
    List<String> parts = new ArrayList<String>();
    parts.add(text.substring(0, 5));
    parts.add(text.substring(3, 7));
    parts.add(text.substring(9, 13));
    parts.add(text.substring(18, 20));
    
    System.out.println(parts); // prints "[01234, 3456, 9abc, ij]"
    
    String[] partsArray = parts.toArray(new String[0]);
    

    Some key ideas:

    • Effective Java 2nd Edition, Item 25: Prefer lists to arrays
      • Works especially nicely if you don’t know how many parts there’ll be in advance

    String API links

    • String substring(int beginIndex, int endIndex)
      • Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.

    Related questions

    • Fill array with List data
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to split a string in Javascript using split function into 2 parts.
I'm using python 2.3.2. In script I want to split a string based on
Really simple problem: I want to split a connection string into its keyword /
Using Java (1.6) I want to split an input string that has components of
I want to split string by setting all non-alphabet as separator. String[] word_list =
I want to split a string like this: abc//def//ghi into a part before and
I want to split a string like 001A into 001 and A
i want to split a string with regex, then create a dom element where
I want to split a string with all non-alphabetic characters as delimiters. For example,
I have a string ABCD:10,20,,40;1/1;1/2,1/3,1/4 I want to split the string into the following

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.