This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Keyword search  RSS feed

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

When i give my item no:8415-00-051-1173 in search bar it displays item details of that particular product.

But i need to get same results when i give without hypens i.e 8415000511173 .

Can anyone guide me to get this result

Thanks,
Jasmine
 
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the format is exactly the same, i.e: nnnn-nn-nnn-nnnn then simply rebuild the string using subString() and concatenation.

WP
 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/javaserver-pages-jsp-jstl/58102-keyword-search.html
 
jasmine dyaga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I used substring and conactenation.



But it is displaying the same results.When i give without "-",it is not displaying the results
 
Sheriff
Posts: 23451
46
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jasmine password wrote:I used substring and conactenation.



No, you didn't. Everything you posted there is a comment, not executable code. (I added the code tags to your post to make it more readable. It would be good if you did that yourself in the future.)
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jasmine password wrote:Hi ,

When i give my item no:8415-00-051-1173 in search bar it displays item details of that particular product.

But i need to get same results when i give without hypens i.e 8415000511173 .

Can anyone guide me to get this result

Thanks,
Jasmine



How do you store item no in database? If it is stored WITH hyphen,

1) If search string is WITHOUT hyphen (eg. 8415000511173) then you need to format your database field, which stores item #, to remove hyphen while comparing in database query. OR if item # has FIXED format of 4-2-3-4 then better way is to format the search string in predefined format and then query database normally.

2) The other case, WITH hyphen is already working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!