Click here to Skip to main content
15,890,438 members
Home / Discussions / C#
   

C#

 
AnswerRe: The best way to change content of main form? Pin
Dave Kreskowiak18-Nov-08 14:36
mveDave Kreskowiak18-Nov-08 14:36 
AnswerRe: The best way to change content of main form? Pin
Mbah Dhaim18-Nov-08 17:54
Mbah Dhaim18-Nov-08 17:54 
QuestionInvalid FORMATETC structure Pin
Jammer18-Nov-08 10:55
Jammer18-Nov-08 10:55 
AnswerRe: Invalid FORMATETC structure Pin
led mike18-Nov-08 11:30
led mike18-Nov-08 11:30 
GeneralRe: Invalid FORMATETC structure Pin
Jammer18-Nov-08 11:54
Jammer18-Nov-08 11:54 
QuestionHow extensively are you using generic methods? Pin
Member 391904918-Nov-08 10:47
Member 391904918-Nov-08 10:47 
AnswerRe: How extensively are you using generic methods? Pin
Pete O'Hanlon18-Nov-08 11:51
mvePete O'Hanlon18-Nov-08 11:51 
AnswerRe: How extensively are you using generic methods? Pin
PIEBALDconsult18-Nov-08 12:15
mvePIEBALDconsult18-Nov-08 12:15 
AnswerRe: How extensively are you using generic methods? Pin
Mark Churchill18-Nov-08 12:59
Mark Churchill18-Nov-08 12:59 
QuestionVGA output in C# Pin
evertqin18-Nov-08 9:47
evertqin18-Nov-08 9:47 
AnswerRe: VGA output in C# Pin
Dan Neely18-Nov-08 10:05
Dan Neely18-Nov-08 10:05 
GeneralRe: VGA output in C# Pin
evertqin18-Nov-08 14:22
evertqin18-Nov-08 14:22 
GeneralRe: VGA output in C# Pin
Dave Kreskowiak18-Nov-08 14:33
mveDave Kreskowiak18-Nov-08 14:33 
GeneralRe: VGA output in C# Pin
evertqin18-Nov-08 17:02
evertqin18-Nov-08 17:02 
GeneralRe: VGA output in C# Pin
Dave Kreskowiak18-Nov-08 17:42
mveDave Kreskowiak18-Nov-08 17:42 
AnswerRe: VGA output in C# Pin
Christian Graus18-Nov-08 11:47
protectorChristian Graus18-Nov-08 11:47 
Questionregular expression cleanup! Pin
nesfrank18-Nov-08 9:14
nesfrank18-Nov-08 9:14 
AnswerRe: regular expression cleanup! Pin
sph3rex18-Nov-08 9:34
sph3rex18-Nov-08 9:34 
AnswerRe: regular expression cleanup! Pin
carbon_golem18-Nov-08 9:54
carbon_golem18-Nov-08 9:54 
AnswerRe: regular expression cleanup! Pin
Garth J Lancaster18-Nov-08 10:17
professionalGarth J Lancaster18-Nov-08 10:17 
nesfrank wrote:
this is too slow


nesfrank wrote:
best performance


I think first of all you need to quantify what you mean here and have a way of timing a simple loop to cleanup the strings. I would have done much the same but in c++ I would have done something like :-

template <class T> 
class is_garbage: public unary_function<char, bool>
{
public:
	bool operator ()(T t) const
	{
		return ( !(isalpha( t ) || isdigit( t )));
	}
};

std::string clean(const std::string& val)
{
	string tmp = val;

   // Clean Up The String
	string::iterator it0= remove_if(tmp.begin(), tmp.end(), is_garbage<char>()); 

	// Assign To Clean String
	string result(tmp.begin(),it0);

	return result;
}


Which isnt that much different from what you've got, a bit more readable maybe Smile | :)

(NB : you would have to alter 'is_garbage' to match what you want, this is straight from my code, Ive made no attempt to replicate your issue)

Are you actually searching for strings within strings, replacing etc ? no ?? then I personally think a regex is an overkill ...

Ive copied this excerpt from John Maddock's page where he has the Regex++ library, although its been in Boost for a while now :-

"Regular expression libraries use a variety of differing algorithms all of which have their pro's and con's, which can make it hard to choose the best implementation for your purpose. This library uses an NFA algorithm which is dedicated to determining fast and accurate sub-expression matches, as well as providing support for features like back-references, which are hard to support using DFA algorithms.

People who should use this library:

Anyone who needs to use wide character strings.
Anyone who needs to search non-contiguous data.
Anyone who wants fast sub-expression matching.
Anyone who wants to customise the regular expression behaviour, or localise the library to a non-English locale.
People who should look to an alternative DFA based library:

Anyone who doesn't care about sub-expression matching, and
Wants to search only ANSI-C strings. " ref http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm[^]

'g'
AnswerRe: regular expression cleanup! [modified] Pin
Robert.C.Cartaino18-Nov-08 11:16
Robert.C.Cartaino18-Nov-08 11:16 
QuestionDataset with 6 columns, how to display only 3 in a data grid? Pin
jeweladdict18-Nov-08 9:06
jeweladdict18-Nov-08 9:06 
AnswerRe: Dataset with 6 columns, how to display only 3 in a data grid? Pin
Wendelius18-Nov-08 9:39
mentorWendelius18-Nov-08 9:39 
AnswerRe: Dataset with 6 columns, how to display only 3 in a data grid? Pin
Priya Prk18-Nov-08 9:40
Priya Prk18-Nov-08 9:40 
GeneralRe: Dataset with 6 columns, how to display only 3 in a data grid? Pin
jeweladdict18-Nov-08 9:47
jeweladdict18-Nov-08 9:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.