Object StringUtilities.Companion
-
- All Implemented Interfaces:
public class StringUtilities.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringUtilities.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final StringbuildString(List<String> strings)Converts a list of Strings, for example from a list, into a concatenated String. final StringbuildString(String args)Converts a sequence of Strings, for example from a list, into a concatenated String. final StringpathSecureText(String text)Remove commonly forbidden characters from the passed string, making the resulting String safe to use for files, paths, directories etc. final StringpathSecureTextAlternative(String text)Remove commonly forbidden characters from the passed string, making the resulting String safe to use for files, paths, directories etc. final BooleancheckForIllegalCharacters(String text)Check the passed string whether it contains any of the following characters: /
<
>
:
"
\
|
?
*
#
%
&
{
}
$
!
@
+
´
`
=
final BooleancheckForInvalidPathCharacters(String text)Check the passed string whether it contains characters invalid in a path-declaration: <
>
:
"
|
?
*
#
%
&
{
}
$
!
@
´
`
=
final StringpercentEncode(String input)Replace '$', ':', '/', '? final StringcreateMongoUri(String user, String password, String host, Integer port, String database)-
-
Method Detail
-
buildString
final String buildString(List<String> strings)
Converts a list of Strings, for example from a list, into a concatenated String.
- Parameters:
strings- List of strings that will be concatenated into one string- Returns:
Returns concatenated string that contains all provided values.
-
buildString
final String buildString(String args)
Converts a sequence of Strings, for example from a list, into a concatenated String.
- Parameters:
args- Strings that will be concatenated into one string- Returns:
Returns concatenated string that contains all provided values.
-
pathSecureText
final String pathSecureText(String text)
Remove commonly forbidden characters from the passed string, making the resulting String safe to use for files, paths, directories etc. If the passed text ends with a SPACE
(  )or a DOT( . ), they are also removed.Replaced/removed are:
/
<
>
:
"
\
|
?
*
#
%
&
{
}
$
!
'
@
+
´
`
=
[
]
- Parameters:
text- The text which you want to be made safe.- Returns:
The passed String safe for use for files, paths, directories etc.
-
pathSecureTextAlternative
final String pathSecureTextAlternative(String text)
Remove commonly forbidden characters from the passed string, making the resulting String safe to use for files, paths, directories etc. If the passed text ends with a SPACE
(  )or a DOT( . ), they are also removed.Contrary to pathSecureText, this method does NOT remove / or \.
Replaced/removed are:
<
>
:
"
|
?
*
#
%
&
{
}
$
!
@
+
´
`
=
[
]
- Parameters:
text- The text which you want to be made safe.- Returns:
The passed String safe for use for files, paths, directories etc.
-
checkForIllegalCharacters
final Boolean checkForIllegalCharacters(String text)
Check the passed string whether it contains any of the following characters:
/
<
>
:
"
\
|
?
*
#
%
&
{
}
$
!
@
+
´
`
=
- Parameters:
text- The text you want to check.- Returns:
trueif none of these characters were found.
-
checkForInvalidPathCharacters
final Boolean checkForInvalidPathCharacters(String text)
Check the passed string whether it contains characters invalid in a path-declaration:
<
>
:
"
|
?
*
#
%
&
{
}
$
!
@
´
`
=
- Parameters:
text- The text you want to check.- Returns:
trueif none of these characters were found.
-
percentEncode
final String percentEncode(String input)
Replace '$', ':', '/', '?', '#', '', '', '@' with percent-encoded characters, according to RFC3986.
-
-
-