aspose file tools*
The moose likes Java in General and the fly likes how to split string using . operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to split string using . operator" Watch "how to split string using . operator" New topic
Author

how to split string using . operator

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
I want to split the string using . operator....but its not spliting when i use split(".") please help me


Creativity is nothing but Breaking Rules
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
You would benefit from a trip to the Java™ Tutorials, where you find that . is a meta-character (not in this instance an operator) matching almost anything. You will also find out how you can escape that character with the backslash character, so it does what you want.
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296

Here it is not spliting the string...?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

If you've read that link Campbell gave you you would have seen that "." is a meta character in regular expressions that means "any character".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
I'm not using regular expression im using only string objects tell me how to split the string using split method
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377



The split method takes in a regular expression as the argument, you must use one.


I love this place!
krishna bala
Ranch Hand

Joined: Jul 20, 2009
Posts: 62
use below code to split string , which has '.' as delimit

String valore = "aaa.bbb.ccc.dddd" ;
for ( String result : valore.split("\\.") ) {
System.out.println(result);
}
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
thanks a lot i got it..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to split string using . operator