OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Case Sensitive search

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
SomeoneHere
OOo Enthusiast
OOo Enthusiast


Joined: 28 Oct 2005
Posts: 116
Location: Boston, Massachusetts USA

PostPosted: Tue Nov 22, 2005 6:43 am    Post subject: Case Sensitive search Reply with quote

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
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Tue Nov 22, 2005 7:44 pm    Post subject: Reply with quote

here is a hint Laughing
Code:
Print LCase("HelLo")

_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Pitounet
OOo Enthusiast
OOo Enthusiast


Joined: 26 May 2005
Posts: 172
Location: Toulouse / France

PostPosted: Wed Nov 23, 2005 1:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group