StringUtils is a class belonging to Apache Commons package. It offers utility methods for dealing with strings.
Questions tagged [apache-stringutils]
112 questions
1
vote
2 answers
Exception in Apache StringUtils
hello guys i am try to use the StringUtils.remove Method but the below exception is raising i have include the jar file and StringUtils.lowercase and String.countsMatches is working only remove is not what may be the problem
<%@page…

King Aslan
- 169
- 3
- 8
- 15
1
vote
2 answers
remove space before and after - in the string
I am trying to remove extra spaces in the string.To achieve this I used normalizeSpace method in StringUtils class. But the problem is it is not removed the spaces before and after "-"
public static void main(String[] args)
{
String test = " Hi -…

sree
- 868
- 2
- 12
- 35
1
vote
0 answers
Only a type can be imported. org.apache.commons.lang.StringUtils resolves to a package
i'm new to JSP and i ran into the following problem: I had to modify an application to add some functionalities, i decided to use StringUtils to find strings between tags and it worked OK on my development environment with Tomcat 7, nevertheless,…

Chander
- 111
- 2
- 9
1
vote
1 answer
Replace Unicode Characters in a String
I need to replace diacritic characters (e.g. ä, ó, etc.) with their 'base' character. For most of the characters, this solution works:
StringUtils.stripAccents(tmpStr);
but this misses four characters: æ, œ, ø, and ß.
I took a look at this solution…

Drew13
- 1,301
- 5
- 28
- 50
1
vote
0 answers
Why org.apache.commons.lang.StringUtils.isBlank() returns false for empty and null values
I saw the implementation of StringUtils.isBlank() and was surprised that in my case, it is not working as expected.
I was writing a Junit and I faced this issue.
AmazonSNSRegistrationService.java:
public String…

Ruchi
- 41
- 6
1
vote
2 answers
Apache lang3 works but Apache lang does not. Why?
I have implemented the spring boot project with starter parent pom version 2.0.3.
When I try to use
import org.apache.commons.lang.StringUtils
it throws error
import cannot be resolved.
Even though my m2 folder…

Vishnu Dahatonde
- 179
- 2
- 13
1
vote
1 answer
Difference between splitByWholeSeparator, splitPreserveAllTokens, and splitByWholeSeparatorPreserveAllTokens
In the org.apache.commons.lang3.StringUtils class, what is the difference between splitByWholeSeparator(String, String), splitPreserveAllTokens(String, String) and splitByWholeSeparatorPreserveAllTokens(String, String)? I checked the JavaDoc and it…

Eric
- 6,563
- 5
- 42
- 66
1
vote
2 answers
StringUtils Overload chop method
I want to overload the chop method of StringUtils to remove the last character if it is a backslash(\).
Is it possible to overload the function or I need to use an if condition?

Mohamed-Ali Elakhrass
- 95
- 1
- 11
1
vote
1 answer
How to substring based on a specific characters through iteration?
I have this following string
String oldStr = ".abc.def.ghi.klm.";
How do I retrieve the substring and put into another string using a loop?
for (int i = 0; i < oldStr.length(); ++i) {
String newStr = doSomethingMethod("oldStr");
}
where oldStr…

J.TrLu
- 65
- 1
- 12
1
vote
3 answers
StringUtils issue in splitting comma containing strings
I want to parse this String Content.
requiredContent='Tigers that breed with lions give birth to hybrids known as "tigons" and "ligers."// In 19th-century Sweden, 380 kids were strangled by their mothers or nurses every year, according to the…

uttam
- 435
- 9
- 24
1
vote
1 answer
Java: Importing StringUtils
I am trying to import StringUtils. My first step was downloading 'commons-lang3-3.4.jar' which I included in the same directory as my PersonTester.java file that I am working on. In my PersonTester.java in which I intend to use StringUtils, I…

btbam91
- 578
- 2
- 8
- 20
1
vote
1 answer
Differences between Crypt.crypt() and DigestUtils.md5() in apache.commons.Codec
I am writing a basic password cracker for the MD5 hashing scheme against a Linux /etc/shadow file. When I use commons.codec's DigestUtils or Crypt libraries, the hash length for them are different (among other things).
When I use the…

lilott8
- 1,116
- 2
- 17
- 41
1
vote
0 answers
Facing NoClassDefFoundError using Commons Lang StringUtils in Java EE Web Application
I have a Struts application for which my organization has been using IBM RAD as the IDE. In this project, we have a Java EE Application project and a Java EE Web Application project. In the Java EE Application project, we have added…

Rakesh Garia
- 109
- 1
- 11
1
vote
4 answers
Java String replace
Lets say I have a string "aabbccaa". Now I want to replace occurrences of "aa" in given string by another string. But it should be in following way.
First occurrence of "aa" should be replaced by "1" and next occurrence of "aa" by "2" and so on.…

hatellla
- 4,796
- 8
- 49
- 101
1
vote
0 answers
StringUtils concurrency exception
I am getting the following error:
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at…

Dejell
- 13,947
- 40
- 146
- 229