Java Scanner Usage getPartOfString(String string, int index, String delimiter)

Here you can find the source of getPartOfString(String string, int index, String delimiter)

Description

get Part Of String

License

Open Source License

Declaration

public static String getPartOfString(String string, int index,
            String delimiter) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    public static String getPartOfString(String string, int index,
            String delimiter) {//from w  ww  . java2  s.  c  o  m
        Scanner scanner = new Scanner(string).useDelimiter(delimiter);

        for (int i = 1; i < index; i++) {
            scanner.next();
        }

        return scanner.next();
    }
}

Related

  1. getNextLine(final Scanner source)
  2. getNextWord(Scanner scan)
  3. getNextWord(String str, int index, StringBuilder outToken, String ignoreRegex)
  4. getNumberOfUsernames(String usernames)
  5. getOutputFromValgrindOutput(String valgrindOutput)
  6. getReplay(String prompt)
  7. getScannerContents(final Scanner scanner)
  8. getStrings(Properties props, String key, String sep)
  9. getStrings(Scanner sc, int n)