java - I want to read what inside this form -



java - I want to read what inside this form -

i have line entered user :

bring together <person> <department>

i want programme read between <>. programme invoke bring together method. 2 arguments person , department.

for example: bring together phone call method:

join("jhon mary","customer service");

join method defined :

public boolean join(string name, string department){...}

something next work, should refine in case user doesn't input valid.

string input = ...; string[] tokens = input.split(" "); string name = tokens[1]; string section = tokens[2]; join(name, department);

again, encourage refine , utilize base. user come in many or few arguments

java string split token stringtokenizer

Comments

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -