Copy a string until character found JAVA

Hello I was wandering how can I copy a piece of a String in Java until a character/symbol is found. In my case the original string is: "hello.1234" and I want only "hello", so that every thing after the symbol . is discarded.

Any idea? many thanks

EDIT:

solved as follows:

String partBeforeFullStop = input.split("\\.")[0];

Answers


Use String#indexOf(int) and String#substring(int).

String input = "hello.1234";
String output = input.substring(0, input.indexOf('.'));

Need Your Help

take next n lines from a file until EOF reached

python file python-2.7 itertools

I have a function, which yields specific columns from a csv file as a list and appends them to a list until a limit of n is reached. The problem is...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.