File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
find string with whitespace in between
Joined: Apr 15, 2009
Jan 06, 2010 16:59:36
I have a
that is separated by a delimeter -. I want to basically extract all the values from this string, and check if there is any whitespace between the values.
if my string is
hello-world- this - is-me
the values would be
and if the string is
hello world- bye-world-hello again world
then the values would be
hello again world
as you can see, in the second example two of the values "hello world", and "hello again world" are separated by whitespaces, and I need to find such values.
Joined: Feb 23, 2009
Jan 06, 2010 17:05:55
Ok first you want to split your string by the dash delimiter. Piece of cake.
String parts = s.split ("-");
As for whitespaces, you'll need to use a regular expression which is '\s'
Check here for reference
An easy to use, light-weight JDBC framework
I agree. Here's the link:
subject: find string with whitespace in between
Pass by reference
java variable argument question
a confused concept
Pass By Reference
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014