split()
accepts a regular expression, so you need to escape .
to not consider it as a regex meta character. Here’s an example :
String[] fn = filename.split("\\.");
return fn[0];
More Related Contents:
- How to split a string if any chracter is found in java
- Split string to equal length substrings in Java
- Splitting on comma outside quotes
- Java string split with “.” (dot) [duplicate]
- Splitting a string at every n-th character
- How to split String with some separator but without removing that separator in Java? [duplicate]
- Extracting pairs of words using String.split()
- Java String.split() Regex
- Split a string, at every nth position
- Java String.split() sometimes giving blank strings
- How to Split a mathematical expression on operators as delimiters, while keeping them in the result?
- Java split is eating my characters
- Split string into repeated characters
- Java replace all square brackets in a string
- Splitting a Java String by the pipe symbol using split(“|”)
- Why in Java 8 split sometimes removes empty strings at start of result array?
- Split string into array of character strings
- Using Java to find substring of a bigger string using Regular Expression
- How to use regex in String.contains() method in Java
- Remove trailing zero in Java
- How do I split a string in Java?
- Java split string to array [duplicate]
- How exactly does String.split() method in Java work when regex is provided?
- Check if string ends with certain pattern
- Java String.replace/replaceAll not working
- How to implement a SQL like ‘LIKE’ operator in java?
- Raw Strings in Java – for regex in particular. Multiline strings
- Java: Get last element after split
- Replacing single ‘\’ with ‘\\’ in Java
- Parse Date from String in this format : dd/MM/yyyy [to dd/MM/yyyy]