The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 okutil_find_strings
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ZRA

Germany
8 Posts

Posted - 06/08/2011 :  07:11:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: 8.1 SR3
Operating System: WinXP Pro SR3

Hi,

I have a problem using "okutil_find_strings()":
I try to use this command to filter a category of imported files (briefly the filename as shown in the project explorer is generated by date_QSet_otherInformations, eg. 20110607_QSet_Repeat1ZRA). When I try to use *QSet* as search string I don't get any hits.


I also tried to copy the example from the help which returned:

#29> okutil_find_strings_Ex1
#A; match(s) to abc found:(OFS_MATCH_WHOLE_STRING)
#abc
#abc123
#D: match(s) to b* found:(* is wild)
#C: match(s) to *b* found:(* is wild)
#D: match(s) to *b* found: (OFS_WILDCHARS_OFF so * is literal)
#E: match(s) to 123 found: (no condition...match anything)
#123abc
#F: match(s) to 123 found: (OFS_MATCH_START_STRING)
#123abc

I think the function ignores any wild characters or interprets them as them-self, independent of the option used.
Could anybody help me please?

Many thanks in advance,
Juergen

eparent

118 Posts

Posted - 06/08/2011 :  5:11:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

The okutil_find_strings function is broken. It appears none of the options are implemented. All comparisons seem to be case insensitive and forced to match the beginning of the strings. I have submitted a bug report for this.
Go to Top of Page

ZRA

Germany
8 Posts

Posted - 06/09/2011 :  02:29:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your reply,

Do you have any idea, how I could avoid using this broken function for the filtering? The problem is that it should be possible to import different files with a similar name scheme (each sample type with an own key-word, such as QSet) and to import a adjustable number of files which will be processed afterwards according to the naming.

Kind regards,
Juergen
Go to Top of Page

eparent

118 Posts

Posted - 06/09/2011 :  09:02:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The following function will work for you even though it does not have all the options as okutil_find_strings.


int find_strings(StringArray& saFound, StringArray& saSearch, LPCSTR lpszFindThis, bool bCaseSensitive)
{
	saFound.SetSize(0);
	for (int i = 0; i < saSearch.GetSize(); ++i)
	{
		if (saSearch[i].Match(lpszFindThis, bCaseSensitive))
			saFound.Add(saSearch[i]);
	}
	return saFound.GetSize();
}

void test_find_strings()
{
	StringArray saSearch;
	saSearch.Add("20110605_QSet_Repeat1ZRA");
	saSearch.Add("20110716_QSet_Blue1YRB");
	saSearch.Add("20110716_RSet_Blue1YRB");        
	saSearch.Add("20110830_QSet_Green2XRC");
	saSearch.Add("20110716_TSet_Blue1YRB");
	saSearch.Add("20110917_QSet_Red3XRD");
	
	StringArray saFound;
	int nFound = find_strings(saFound, saSearch, "*QSet*", false);
	printf("Found %d matches:\n", nFound);
	for (int i = 0; i < saFound.GetSize(); ++i)
		printf("%d  %s\n", i, saFound[i]);
}
Go to Top of Page

ZRA

Germany
8 Posts

Posted - 06/10/2011 :  01:48:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your help. The function works fine for me.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000