Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Whole word find string
Whole word find string [message #27044] Tue, 22 June 2010 21:32 Go to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I need to find a substring in "whole word" mode.
For example, if I look for "Lui" and the string is
"my name is Luigi" the search should produce no result as I want just "Lui" and not "Luigi". The sign ",.:;-" should be considered white space.

This feature is available for example in the "Find in Files..." option in theide. I was not able to find a similar option neither in the String method nor in Bazaar.
Is it really not available or am I blind?

Thanks,
Luigi

EDIT: it seems the code I need could be in
bool CodeEditor::Find(bool back, const wchar *text, bool wholeword, bool ignorecase, bool wildcards, bool block)

[Updated on: Tue, 22 June 2010 22:45]

Report message to a moderator

Re: Whole word find string [message #27067 is a reply to message #27044] Thu, 24 June 2010 09:30 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
forlano wrote on Tue, 22 June 2010 21:32

Hello,

I need to find a substring in "whole word" mode.


It seems the RegExp library does the job.
Something like this:

String p = "(\\b" + pattern + "\\b)";
RegExp r0(p);
if( r0.Match( mystring ) ) { ... }

is able to find the string pattern in whole word mode. The trick was to set the \\b at the begin and at the end of the wanted string.

Luigi

Re: Whole word find string [message #27068 is a reply to message #27067] Thu, 24 June 2010 09:38 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

So problem solved?

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Whole word find string [message #27071 is a reply to message #27068] Thu, 24 June 2010 12:37 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Thu, 24 June 2010 09:38

So problem solved?


Yes, it was solved. RegEx looks very poverfull.

Poka,
Luigi
Previous Topic: int64 formating
Next Topic: [NOT A BUG!] DayOfWeek
Goto Forum:
  


Current Time: Mon Apr 29 18:19:00 CEST 2024

Total time taken to generate the page: 0.03757 seconds