Java Scanner Usage getNumberOfUsernames(String usernames)

Here you can find the source of getNumberOfUsernames(String usernames)

Description

get Number Of Usernames

License

Open Source License

Declaration

public static int getNumberOfUsernames(String usernames) 

Method Source Code

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

import java.util.Scanner;

public class Main {
    public static int getNumberOfUsernames(String usernames) {
        Scanner scanner = new Scanner(usernames);
        scanner.useDelimiter(",");

        int i = 0;
        while (scanner.hasNext()) {
            scanner.next();//from   w  w w  .  j  ava 2  s.com
            i++;
        }

        return i;
    }
}

Related

  1. getNextInput(Scanner scan)
  2. getNextLine(final Scanner scanner)
  3. getNextLine(final Scanner source)
  4. getNextWord(Scanner scan)
  5. getNextWord(String str, int index, StringBuilder outToken, String ignoreRegex)
  6. getOutputFromValgrindOutput(String valgrindOutput)
  7. getPartOfString(String string, int index, String delimiter)
  8. getReplay(String prompt)
  9. getScannerContents(final Scanner scanner)