You need to sign in to do that
Don't have an account?
Sudhanwa
trim white spaces between two words
There is a problem in my search function. When I enter more than a single white space between two words in the key word, it does not retrieve the record.
For example, I have this account called 'Pink Floyd'. When I try to search through my search function by entering the key words as 'Pink Floyd', it does not match. Any work around for trimming the white spaces?
Thanks,
Sudhanwa.
You could use a regular expression to remove any multiple white spaces before doing search:e.g.
string mySearch = 'abc 123';
mySearch = mySearch.replaceAll('\\s+',' ');
//now do search
R.
All Answers
You could use the LIKE clause and replace whitespace with %. You could also have the user select a exact or wildcard search to determine if you want to just use the search string they entered exactly or the LIKE Clause with % replacing whitespace?
You could use a regular expression to remove any multiple white spaces before doing search:e.g.
string mySearch = 'abc 123';
mySearch = mySearch.replaceAll('\\s+',' ');
//now do search
R.
Thanks a ton buddy. It worked.
Cheers,
Sudhanwa,