• Post Reply Bookmark Topic Watch Topic
  • New Topic

checking values in a string  RSS feed

 
rajkumar soundararajan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Suppose i have a string which has certain file names, S = "a.png, b.gif, c.xlsx, d.docx, e.xlsx, f.gif";

I need to check if the string has more than one .xlsx file names,

How do i achieve this?

Regards,
RAJ
 
Srikkanth Mohansundaram
Greenhorn
Posts: 16
AngularJS Chrome jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raj,

Did you start by writing some code ? There are multiple ways to do this

1. Check the occurence of ".xlsx" in the string.
2. Split the string by the delimiter (",") and count the occurence and so on.

Thanks
Srikkanth

 
rajkumar soundararajan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is my requirement.
If the string has one value of .xlsx then i need to extract the .xlsx file name,
If the string has more than one value of .xlsx then i should say this string has error.

Is there any direct methods available to check if the string has more than one .xlsx file?
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you implemented something?
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a number of elements to this problem. Let's start with something simple:

How would you determine if a String contains at least one occurrence of the String value ".xlsx"?

Hint: Find out what methods are available on Java String. (There is more than one way to achieve this).
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just noticed that you have already had half of this discussion in your other thread a few days ago. Did you do anything with Henry and Tony's suggestions? Why have you created this new thread?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!