• Post Reply Bookmark Topic Watch Topic
  • New Topic

weird output of space delimiter example  RSS feed

 
piyu patel
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to run this delimiter example on command line.


it gives following output. rather than giving me average.

6,7.4 ,9.1 ,10.5
File format error.

 
Carey Brown
Saloon Keeper
Posts: 3312
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove spaces on either side of your commas in your fout.write() call.

Edit: or - change delimiter to " *, *".
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should be careful about using " " in a regex if you really mean any whitespace character as opposed to specifically the space character. It's more advisable to use \s which means any whitespace character (which include tabs, line breaks, form feeds etc) so your regex delimiter should probably be "\\s*,\\s*"
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!