Questions tagged [string-utils]
50 questions
2
votes
2 answers
Break a string in substrings (lines) without split words
i'm working in a small function that should break a string in substrings making sure that none of words will be cutted.
Let's get this use case:
"something is going wrong and i can't figure out what's the problem"
total characters: 63;
with a max…

Lothre1
- 3,523
- 7
- 43
- 64
1
vote
1 answer
Where can I access StringUtils.replaceEach()?
The answer to Java escape HTML shows StringUtils.replaceEach() which runs similar to multiple StringUtils.replace()s, but accepting arrays of Strings instead of having to do each replace individually.
For example:
str = StringUtils.replace(str, "&",…

Xonatron
- 15,622
- 30
- 70
- 84
1
vote
1 answer
Apache Commons Lang comes by default with Spring Boot?
I have a requirement in my project to delete from build.gradle the implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0' and instead use apache commons lang (which comes by default with Spring Boot).
I don't know the…

Robert
- 13
- 1
- 2
- 4
1
vote
1 answer
JBoss vs Tomcat - StringUtils.isEmpty
I was developing using Tomcat and everything was doing perfect.
Now I switched to JBoss, and when the application reaches the StringUtils.isEmpty code, it finds a
Caused by: java.lang.reflect.InvocationTargetException
I tried using the same…

Gondim
- 3,038
- 8
- 44
- 62
1
vote
2 answers
String utils split - linux
Below Java code works in Windows machine
filepath = "euro\football\france\winners.txt";
String[] values = StringUtils.split(filePath, "\\");
if (values != null && values.length >= 4) {
} else {
//error
}
But facing issue in linux while…

Jessie
- 963
- 5
- 16
- 26
1
vote
1 answer
removing duplicates from string array - using HashSet
Im trying to convert a string array with duplicates to string array without duplicates by using hashSet like below.
String[] d = new HashSet(Arrays.asList(duplicateList)).toArray(new String[0]);
duplicateList =…

Geek
- 3,187
- 15
- 70
- 115
1
vote
1 answer
Extract string using StringUtils
Let's take a string "aabaabaa" and I want to know the position of "aa" in middle or from last.
For example position of "aa" from right should be : 6 (taking start insex as 0)

Sumit Sahoo
- 2,949
- 1
- 25
- 37
0
votes
0 answers
Validate String in Java To Avoid Path Traversal
I have a system where user can upload file. I want to throw an exception in case the filename is contains sensitive characters like "../", etc. (to avoid Path Traversal vulnerability: "file/../../file.txt").
I have the code String originalFilename =…

rons1
- 21
- 2
0
votes
2 answers
StringUtils problems. How to fix this String alphabet letter check?
This code takes an input string from the user, which may contain special characters. We then output the letters that are missing from the alphabet. For example, "the quick brown fox jumped over the lazy dog" would have an empty string returned, but…

fpm21
- 13
- 3
0
votes
1 answer
String truncation in Java based on some conditions
My requirement is to truncate the string with max count and based on some conditions. The conditions are,
The length of the string should not exceed the max count
It should not end with half word like I want to trun
The end of the string should be…

Aravindan Venkatesan
- 618
- 5
- 9
0
votes
1 answer
Convert accent characters to english using java
I have a requirement where i need to search with accent characters that can be for users from Iceland and Japan. The code which i wrote works for a few accent characters but not all.
Below example -
À - returns a. Correct.
 - returns a. Correct.
Ð…

sTg
- 4,313
- 16
- 68
- 115
0
votes
1 answer
Java validating input values
private String createSearchFieldContent(OverrideableStringValue title,
OverrideableContactValue owner) {
StringBuilder builder = new StringBuilder(getValue(title));
if…

macintosh
- 13
- 2
0
votes
1 answer
Django simple-apps template error - no StringUtil
I'm trying to use django basic apps from this site to make a basic blog work. It seemed to be going ok, but now the template keeps throwing an error saying "'stringutils' is not a valid tag library: Template library stringutils not found".
Sure…

Alex S
- 4,726
- 7
- 39
- 67
0
votes
1 answer
The method isNullOrEmpty(String) is undefined for the type StringUtils
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.MDC;
import java.util.UUID;
import org.springframework.util.StringUtils;
import…
user11965799
0
votes
2 answers
How to get UpperCamelCase using StringUtils?
I can't seem to get StringUtils.capitalize to actually capitalize my whole word string.
I've tried various ways, but I just end up getting sentence-type case. I tried using StringUtils.capitalize inside of what I want to print, but that doesn't work…

Michael K.
- 43
- 1
- 9