Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use delimeter  RSS feed

 
peter kosmas
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ...
I am now starting a topic and i want to use multiple delimeters to break a file

something like this
person is the 1 nice name of 2 of this type 3 and bla bla bla 4 and blablabla 5
and i want to break the lines where the numbers are
i use usedelimeter("[1-50]") but it does not work
can someone help me ???
Scanner scanner=new Scanner(file);
scanner.useDelimiter("[1-50]");
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because [1-50] is defining a character range, not a numeric range.
 
peter kosmas
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found it
scanner.useDelimiter("[0-9]+");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!