Top Inners Constructors Methods
org.jabref.logic.util.strings

public Class StringManipulator

extends Object
Class Inheritance
Imports
org.jabref.logic.formatter.casechanger.CapitalizeFormatter, .LowerCaseFormatter, .UpperCaseFormatter, org.jabref.model.util.ResultingStringState

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum
private static enum

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ResultingStringState

Returns:

String The resulting text and caret position.
backwardKillWord
(int
The position of the cursor
caretPosition
,
String
The string to manipulate
text
)

Remove the previous word on the left side of the cursor.

public static ResultingStringState

Returns:

String The resulting text and caret position.
capitalize
(int
The position of the cursor
caretPosition
,
String
The string to manipulate
text
)

Capitalize the word on the right side of the cursor.

pack-priv static ResultingStringState

Returns:

The resulting text and caret position.
deleteUntilWordBoundary
(int
The index to start from.
caretPosition
,
String
The text to manipulate.
text
,
StringManipulator.Direction
The direction to search.
direction
)

Delete all characters in a string from the given position to the next word boundary.

pack-priv static int

Returns:

The position of the next whitespace after a word
getNextWordBoundary
(int
The current caret position
caretPosition
,
String
The string to search in
text
,
StringManipulator.Direction
The direction to move through string
direction
)

Utility method to find the next whitespace position in string after text

public static ResultingStringState

Returns:

String The resulting text and caret position.
killWord
(int
The position of the cursor
caretPosition
,
String
The string to manipulate
text
)

Remove the next word on the right side of the cursor.

public static ResultingStringState

Returns:

String The resulting text and caret position.
lowercase
(int
The position of the cursor
caretPosition
,
String
The string to manipulate
text
)

Make all characters in the word lowercase.

private static ResultingStringState

Returns:

The resulting text and caret position.
setWordCase
(String
The text to manipulate.
text
,
int
The index to start from.
caretPosition
,
StringManipulator.LetterCase
The case mode the string should be changed to.
targetCase
)

Change word casing in a string from the given position to the next word boundary.

public static ResultingStringState

Returns:

String The resulting text and caret position.
uppercase
(int
The position of the cursor
caretPosition
,
String
The string to manipulate
text
)

Make all characters in the word uppercase.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringManipulatorback to summary
public StringManipulator()

Method Detail

backwardKillWordback to summary
public static ResultingStringState backwardKillWord(int caretPosition, String text)

Remove the previous word on the left side of the cursor.

Parameters
caretPosition:int

The position of the cursor

text:String

The string to manipulate

Returns:ResultingStringState

String The resulting text and caret position.

capitalizeback to summary
public static ResultingStringState capitalize(int caretPosition, String text)

Capitalize the word on the right side of the cursor.

Parameters
caretPosition:int

The position of the cursor

text:String

The string to manipulate

Returns:ResultingStringState

String The resulting text and caret position.

deleteUntilWordBoundaryback to summary
pack-priv static ResultingStringState deleteUntilWordBoundary(int caretPosition, String text, StringManipulator.Direction direction)

Delete all characters in a string from the given position to the next word boundary.

Parameters
caretPosition:int

The index to start from.

text:String

The text to manipulate.

direction:StringManipulator.Direction

The direction to search.

Returns:ResultingStringState

The resulting text and caret position.

getNextWordBoundaryback to summary
pack-priv static int getNextWordBoundary(int caretPosition, String text, StringManipulator.Direction direction)

Utility method to find the next whitespace position in string after text

Parameters
caretPosition:int

The current caret position

text:String

The string to search in

direction:StringManipulator.Direction

The direction to move through string

Returns:int

The position of the next whitespace after a word

killWordback to summary
public static ResultingStringState killWord(int caretPosition, String text)

Remove the next word on the right side of the cursor.

Parameters
caretPosition:int

The position of the cursor

text:String

The string to manipulate

Returns:ResultingStringState

String The resulting text and caret position.

lowercaseback to summary
public static ResultingStringState lowercase(int caretPosition, String text)

Make all characters in the word lowercase.

Parameters
caretPosition:int

The position of the cursor

text:String

The string to manipulate

Returns:ResultingStringState

String The resulting text and caret position.

setWordCaseback to summary
private static ResultingStringState setWordCase(String text, int caretPosition, StringManipulator.LetterCase targetCase)

Change word casing in a string from the given position to the next word boundary.

Parameters
text:String

The text to manipulate.

caretPosition:int

The index to start from.

targetCase:StringManipulator.LetterCase

The case mode the string should be changed to.

Returns:ResultingStringState

The resulting text and caret position.

uppercaseback to summary
public static ResultingStringState uppercase(int caretPosition, String text)

Make all characters in the word uppercase.

Parameters
caretPosition:int

The position of the cursor

text:String

The string to manipulate

Returns:ResultingStringState

String The resulting text and caret position.

org.jabref.logic.util.strings back to summary

pack-priv final Enum StringManipulator.Direction

extends Enum<StringManipulator.Direction>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final StringManipulator.Direction
public final int
public static final StringManipulator.Direction

Constructor Summary

AccessConstructor and Description
private
Direction(int offset)

Method Summary

Modifier and TypeMethod and Description
public static StringManipulator.Direction
public static StringManipulator.Direction[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

NEXTback to summary
public static final StringManipulator.Direction NEXT
OFFSETback to summary
public final int OFFSET
PREVIOUSback to summary
public static final StringManipulator.Direction PREVIOUS

Constructor Detail

Directionback to summary
private Direction(int offset)

Method Detail

valueOfback to summary
public static StringManipulator.Direction valueOf(String name)
valuesback to summary
public static StringManipulator.Direction[] values()
org.jabref.logic.util.strings back to summary

private final Enum StringManipulator.LetterCase

extends Enum<StringManipulator.LetterCase>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final StringManipulator.LetterCase
public static final StringManipulator.LetterCase
public static final StringManipulator.LetterCase

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static StringManipulator.LetterCase
public static StringManipulator.LetterCase[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CAPITALIZEDback to summary
public static final StringManipulator.LetterCase CAPITALIZED
LOWERback to summary
public static final StringManipulator.LetterCase LOWER
UPPERback to summary
public static final StringManipulator.LetterCase UPPER

Constructor Detail

LetterCaseback to summary
private LetterCase()

Method Detail

valueOfback to summary
public static StringManipulator.LetterCase valueOf(String name)
valuesback to summary
public static StringManipulator.LetterCase[] values()