醉死梦生
Thursday, December 17, 2009 1:04:59 PM
小姐簇拥二奶来
----我醉欲眠卿且去,明朝有意抱琴来
Wednesday, March 10, 2010 2:12:44 PM
Wrote an application for my hero mobile phone to calculate the days between two dates. It is my first application for android system.Thursday, January 22, 2009 11:04:42 AM
Thursday, January 8, 2009 7:09:23 AM
(defun toggle-ecb-active()
"Toggle ecb active and deactive"
(interactive)
(if ecb-minor-mode
(ecb-deactivate)
(ecb-activate))
)
(global-set-key [f6] 'toggle-ecb-active)
Thursday, November 20, 2008 1:05:28 PM
Wednesday, September 3, 2008 10:17:06 AM
Wednesday, August 13, 2008 9:15:18 AM
Thursday, July 3, 2008 7:20:04 AM
#include <stdio.h>
#include <string.h>
//
// b_full means the whole string matching
//
bool WildSearch(char *psz_buf, int n_buflen, char *psz_sub, int n_sublen, bool b_full, char sz_prechar)
{
if (n_buflen == 0 && n_sublen != 0)
{
if (n_sublen == 1 && psz_sub[0] == '*')
{
return true;
}
else
{
return false;
}
}
else if (n_buflen != 0 && n_sublen == 0)
{
if (b_full)
{
return false;
}
else
{
return true;
}
}
else if (n_buflen == 0 && n_sublen == 0)
{
return true;
}
if (psz_sub[0] == '*')
{
psz_sub++;
n_sublen--;
if (n_sublen == 0)
{
return true;
}
return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, '*');
}
else if (psz_sub[0] == '?')
{
psz_buf++;
n_buflen--;
psz_sub++;
n_sublen--;
return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, '?');
}
else
{
char *psz_star_pos = strchr(psz_sub, '*');
char *psz_question_pos = strchr(psz_sub, '?');
int n_len_to_star = (psz_star_pos == NULL) ? (int)strlen(psz_sub) : (int)(psz_star_pos - psz_sub);
int n_len_to_question = (psz_question_pos == NULL) ? (int)strlen(psz_sub) : (int)(psz_question_pos - psz_sub);
int n_compare_len = n_len_to_question > n_len_to_star ? n_len_to_star : n_len_to_question;
if (_strnicmp(psz_buf, psz_sub, n_compare_len) == 0)
//if (psz_buf[0] == psz_sub[0])
{
sz_prechar = psz_sub[0];
psz_buf++;
n_buflen--;
psz_sub++;
n_sublen--;
return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, sz_prechar);
}
else
{
if (sz_prechar != '*')
{
return false;
}
psz_buf++;
n_buflen--;
return WildSearch(psz_buf, n_buflen, psz_sub, n_sublen, b_full, sz_prechar);
}
}
return true;
}
int main(int argc, char** argv)
{
char sz_buf[] = "abcdefghijk";
char sz_sub[] = "abc?e*fg?i?*k*";
//char sz_sub[] = "ae";
bool b_result = WildSearch(sz_buf, (int)strlen(sz_buf), sz_sub, (int)strlen(sz_sub), false, ' ');
printf("%d\n", b_result);
return 0;
}
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | |||
pc and mobile phone tools