Jump to content

How to filter output using the Java printf statement


babyboomer

Recommended Posts

Is it possible to use a formatting (escape) sequence in the Java printf statement to remove specific characters from the string argument? For example, if I have a string like, "[0, 1]", is there a formatting string I can use to remove the left and right bracket characters ([])? Is there a "regular expression" for the Java printf statement that will filter out those characters?

Link to comment
Share on other sites

  • 3 weeks later...
On 11/17/2019 at 4:42 AM, babyboomer said:

Is it possible to use a formatting (escape) sequence in the Java printf statement to remove specific characters from the string argument? For example, if I have a string like, "[0, 1]", is there a formatting string I can use to remove the left and right bracket characters ([])? Is there a "regular expression" for the Java printf statement that will filter out those characters?

Yes. It will helpful.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...