Skip to content
Advertisement

Tag: spaces

Adding whitespace in Java

There is a class trim() to remove white spaces, how about adding/padding? Note: ” ” is not the solution. Answer I think you are talking about padding strings with spaces. One way to do this is with string format codes. For example, if you want to pad a string to a certain length with spaces, use something like this: In

JEditorPane – make tabs spaces

I’m wondering if there’s a way to have tabs convert to spaces in a jeditorpane, much like you’d see when working in an IDE. I don’t want to set the tab size. I can already do that easily. I want to have tabs replaced with their equivalent in spaces. So for example if my tabs are 5 spaces long, I

Advertisement