掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
特定の文字を探し出すには (ID:62705)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
> boost使って良いなら 私ならば、正規表現かな。 #include <iostream> #include <locale> #include <boost/regex.hpp> struct grep_predicate { bool operator() ( const boost::match_results< std::wstring::const_iterator >& m ) { std::wcout << m.str(0) << std::endl; return true; } }; int main() { std::locale::global( std::locale( "japanese" ) ); const std::wstring source = L"$GPGGA,071855.6,3509.4505,N,13847.6955,E,1,4,2.35,,M,,M,,*69"; boost::reg_expression< wchar_t > regex( L"[^\\,]{5}[^\\,]*" ); boost::regex_grep( grep_predicate(), source.begin(), source.end(), regex ); return 0; }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.