dev/c/GLib_bcb/test_glib_bcb/main.cpp

41 lines
1004 B
C++

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <tchar.h>
//---------------------------------------------------------------------------
#pragma argsused
#include "glib.h"
static void
print_uppercase_words (const gchar *string)
{
/* Print all uppercase-only words. */
GRegex *regex;
GMatchInfo *match_info;
regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
g_regex_match (regex, string, 0, &match_info);
while (g_match_info_matches (match_info))
{
gchar *word = g_match_info_fetch (match_info, 0);
g_print ("Found: %s\n", word);
g_free (word);
g_match_info_next (match_info, NULL);
}
g_match_info_free (match_info);
g_regex_unref (regex);
}
int _tmain(int argc, _TCHAR* argv[])
{
print_uppercase_words ("kldj sfj LKJDSF SmeshAnn");
system ("pause");
return 0;
}
//---------------------------------------------------------------------------