Here you can find the source of divide(final String s)
Parameter | Description |
---|---|
s | String to divide |
public static String[] divide(final String s)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w ww . java 2s . c o m*/ * When using commands you seperate the command from the arguments with a * space. divide gets a command and returns the command and the args in an * Array. * * @param s * String to divide * @return Array made with command and arguments */ public static String[] divide(final String s) { for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == ' ') { final String[] res = { s.substring(0, i).trim().toLowerCase(), s.substring(i, s.length()).trim().toLowerCase() }; return res; } } final String[] res = { s.trim().toLowerCase(), "" }; return res; } }