| View previous topic :: View next topic |
| Author |
Message |
SomeoneHere OOo Enthusiast

Joined: 28 Oct 2005 Posts: 116 Location: Boston, Massachusetts USA
|
Posted: Tue Nov 22, 2005 6:43 am Post subject: Case Sensitive search |
|
|
I did a search but with no luck with what I am looking for. Any suggestions I could get would be great. This is what is going on...I have a dialog box that takes an input from the user, this input string is then searched through the whole document so that another dialog box is prompted when that string is found so that you can enter values to be inserted. But anyway the search is a string search but there are certain words that are abreviated in the sheet. For instance if the user enters "manchester" I want to take that word and instead of inserting that into a global variable I would enter "man" because that is what it is in the sheet. Now I was just going to do this with a simple if statement like this for the ones I needed
| Code: |
if(string = "manchester") then
string = "man"
end if
|
but this will only put man in the string if it is exact. So if the user entered Manchester or MANCHESTER this would not work. And rather than do all possible combinations of capital and lowercase letters I was wondering if anyone could give me an idea to take care of this problem. Thanks for anything you can do |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Tue Nov 22, 2005 7:44 pm Post subject: |
|
|
here is a hint
| Code: | | Print LCase("HelLo") |
_________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
Pitounet OOo Enthusiast


Joined: 26 May 2005 Posts: 172 Location: Toulouse / France
|
Posted: Wed Nov 23, 2005 1:18 am Post subject: |
|
|
Use the StrComp function:
| Code: | if (StrComp(string,"manchester",0) = 0 then
string = "man"
end if |
The thrid argument of StrComp set 0 indicates a non case-sensitive comparison.
See OOo basic on-line help for further information.
Antoine. |
|
| Back to top |
|
 |
|