public class TextEditor extends Object
Constructor and Description |
---|
TextEditor(CharSequence text)
Create a new TextEditor based on the contents of a String or
StringBuffer.
|
Modifier and Type | Method and Description |
---|---|
void |
append(CharSequence s)
Add a string to the end of the buffer.
|
TextEditor |
deleteAll(String pattern)
Remove all occurrences of the given regex pattern, replacing them
with the empty string.
|
TextEditor |
detabify()
Convert tabs to spaces given the default tab width of 4 spaces.
|
TextEditor |
detabify(int tabWidth)
Convert tabs to spaces.
|
TextEditor |
indent(int spaces)
Introduce a number of spaces at the start of each line.
|
boolean |
isEmpty()
Find out whether the buffer is empty.
|
TextEditor |
outdent()
Remove one tab width (4 spaces) from the start of each line.
|
TextEditor |
outdent(int spaces)
Remove a number of spaces at the start of each line.
|
void |
prepend(CharSequence s)
Add a string to the start of the first line of the buffer.
|
TextEditor |
replaceAll(Pattern pattern,
Replacement replacement)
Replace all occurrences of the Pattern.
|
TextEditor |
replaceAll(String regex,
String replacement)
Replace all occurrences of the regular expression with the replacement.
|
TextEditor |
replaceAllLiteral(String regex,
String replacement)
Same as replaceAll(String, String), but does not interpret
$1, $2 etc.
|
Collection<HTMLToken> |
tokenizeHTML()
Parse HTML tags, returning a Collection of HTMLToken objects.
|
String |
toString()
Give up the contents of the TextEditor.
|
TextEditor |
trim()
Remove leading and trailing space from the start and end of the buffer.
|
public TextEditor(CharSequence text)
text
- public String toString()
public TextEditor replaceAll(String regex, String replacement)
regex
- replacement
- public TextEditor replaceAllLiteral(String regex, String replacement)
regex
- replacement
- public TextEditor replaceAll(Pattern pattern, Replacement replacement)
pattern
- replacement
- public TextEditor deleteAll(String pattern)
pattern
- Regular expressionPattern
public TextEditor detabify()
public TextEditor detabify(int tabWidth)
tabWidth
- Number of spaces per tab.public TextEditor outdent(int spaces)
spaces
- public TextEditor outdent()
public TextEditor trim()
public TextEditor indent(int spaces)
spaces
- public void append(CharSequence s)
s
- public Collection<HTMLToken> tokenizeHTML()
public void prepend(CharSequence s)
s
- public boolean isEmpty()
Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.