• Post Reply Bookmark Topic Watch Topic
  • New Topic

Filter filename  RSS feed

 
S Roberts
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i filter the filenames before first dot in the filename with regex? i got the filename earlier with such a line:


now i need to get the filename for example:from filename1.data.txt only the filename1. How can i do it?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i filter the filenames before first dot in the filename with regex? i got the filename earlier with such a line:


now i need to get the filename for example:from filename1.data.txt only the filename1. How can i do it?


The String.indexOf and String.substring methods together can accomplish this.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option is
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or

which will remove everything after and including the first '.' .
 
S Roberts
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you it works
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!