Questions tagged [apache-stringutils]

StringUtils is a class belonging to Apache Commons package. It offers utility methods for dealing with strings.

112 questions
0
votes
1 answer

ivy eclipse NoClassDefFoundError: org/apache/commons/lang3/StringUtils

I know this question has been solved but none of the answers solve my problem. Also I am new in this. I do get NoClassDefFoundError: org/apache/commons/lang3/StringUtils I can see it resolves the dependencies but when I run the jar after…
0
votes
1 answer

Finding Substrings Between Nested Tags in Java

I'm working on a method that needs to parse a string representing a Type declaration into its constituent parts. So for example the string "List" would produce the following array: ["List", "T", "extends", "Integer"] For…
pbuchheit
  • 1,371
  • 1
  • 20
  • 47
0
votes
1 answer

How to efficiently check whether given URL(String) contains whitelist domain(String) in Java

I need to write a utility method which will take a url and check whether given url is valid or not ? URL can be anything with/without protocol like http, https or with can contain the relative url like if domain is example and url is "abc.com" then…
user7851946
0
votes
2 answers

Extract Substring from String java

I want to extract specific substrings from a string: String source = "info1 info1ContentA info1ContentB info3 info3ContentA info3ContentB"+ "info2 info2ContentA"; The result should be: String info1 ="info1ContentA info1ContentB"; String info2…
moses
  • 155
  • 3
  • 15
0
votes
3 answers

StringUtils.isBlank vs. Regexp

So I am looking through some legacy code and finding instance where they do this: if ((name == null) || (name.matches("\\s*"))) .. do something Ignore for the moment that the .matches(..) call creates a new Pattern and Matcher everytime (uhg) -…
Gandalf
  • 9,648
  • 8
  • 53
  • 88
0
votes
1 answer

NoClassDefFoundError: org/apache/commons/lang/StringUtils

I am writing map reduce program to compare two files.When I run the program it throws following exception. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils at…
Arun Kumar
  • 21
  • 1
  • 2
  • 3
0
votes
2 answers

print text show the file path using Java

I need a java method to check text
0
votes
1 answer

adding xml tag mapping to text file using hashmap not working

Hi I am parsing xml tags without using any parser just using StringUtils.substring as I need only 2 tags values. after I get these values I am adding it to list and with these 2 lists I am preparing map with values and keys. This Hash map I want to…
0
votes
2 answers

How to create two arrays with shared data in Java

First the reason I need to do this is because of the API in Apache's Commons StringUtils method: StringUtils.replaceEach(String text, String[] searchList, String[] replacementList) What I want to do is replace all the HTML special character…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
0
votes
0 answers

StringUtils.containsIgnoreCase() is returning wrong result

i have two values: String a = "00tz"; // (Eclipse internal debug value: [, 0, 0, t, z]) and String b = "tz"; // (Eclipse internal debug value: [, t, z]) I am reading this values from an ArrayList like for (String a : stringLists) { ... } I get…
0
votes
1 answer

StringUtils - Replace on the same line different words

I read that using String.replaceAll is very slow. This how I do in old way: String settence = "Java /*with*/ lambda /*expressions*/"; String replaceSettence = settence.replaceAll(Pattern.quote("/*with*/"),…
Goldbones
  • 1,407
  • 3
  • 21
  • 55
0
votes
0 answers

replace multiple sequence of letters from a search keyword at a time

I have an ORACLE CONTAINS search like this. WHERE CONTAINS (FIRST_NAME, '%' || 'Müller' || '%') I have a problem in searching inputs that contains strings such as "and", "btg", "sqe", "ntp" etc. I am looking for a way to replace or escape all these…
kjkszpj
  • 81
  • 1
  • 1
  • 4
0
votes
2 answers

Java searching for a substring URL in a string URL

I have a couple of URLs: a. https://iamterribleatthis/a b. https://iamterribleatthis/a/index.html I'm using Apache stringutls to see if 'a' is present in 'b' but I think that the forward slash is failing the comparison. Is there an easier/better…
user6123723
  • 10,546
  • 18
  • 67
  • 109
0
votes
2 answers

StringUtils.countMatches words starting with a string?

I'm usingStringUtils.countMatches to count word frequencies, is there a way to search text for words starting-with some characters? Example: searching for art in "artificial art in my apartment" will return 3! I need it to return 2 for words…
PhDeveloper
  • 335
  • 1
  • 4
  • 14
0
votes
1 answer

Resultset giving only one row as result even there are many rows

Here is my query i have done using jdbc.webshopProducts is the Map. StringBuilder queryString=new StringBuilder(); queryString.append(" select cpm.name,cpm.catalogueprice,cpm.catalogueno "); queryString.append(" from…
sai
  • 109
  • 2
  • 13