What is a delimiter in java ?

Delimiters in java are the characters that split the string into tokens

  • In java we can define any characters as delimiter
  • There are many string split methods provides by Java that uses whitespace character as a delimiter. The whitespace delimiter is the default delimiter in Java 
  • The string is made up of two types of text that are tokens and delimiters.
  • The tokens are the words that are meaningful, and the delimiters are the characters that split the tokens.
  • Returning the delimiters as tokens is useful if for instance commas separated fields and carriage returns separated records
  • Using the delimiter you can determine whether the next token is a new field or a new record

Example :

((a_12 + 23.59) * (4563 – 32));

If numbers and variable names are our tokens, the delimiters are characters in the string “()+*; “

Leave a Comment