[openrtm-commit:00377] r2227 - trunk/OpenRTM-aist/src/lib/coil/common
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 8月 25日 (木) 01:34:02 JST
Author: n-ando
Date: 2011-08-25 01:34:02 +0900 (Thu, 25 Aug 2011)
New Revision: 2227
Modified:
trunk/OpenRTM-aist/src/lib/coil/common/stringutil.cpp
trunk/OpenRTM-aist/src/lib/coil/common/stringutil.h
Log:
Now coil::flatten receives delimiter.
Modified: trunk/OpenRTM-aist/src/lib/coil/common/stringutil.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/common/stringutil.cpp 2011-08-24 16:32:56 UTC (rev 2226)
+++ trunk/OpenRTM-aist/src/lib/coil/common/stringutil.cpp 2011-08-24 16:34:02 UTC (rev 2227)
@@ -546,14 +546,14 @@
* @brief Create CSV file from the given string list
* @endif
*/
- std::string flatten(vstring sv)
+ std::string flatten(vstring sv, std::string delimiter)
{
if (sv.size() == 0) return "";
std::string str;
for (size_t i(0), len(sv.size() - 1); i < len; ++i)
{
- str += sv[i] + ", ";
+ str += sv[i] + delimiter;
}
return str + sv.back();
}
Modified: trunk/OpenRTM-aist/src/lib/coil/common/stringutil.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/common/stringutil.h 2011-08-24 16:32:56 UTC (rev 2226)
+++ trunk/OpenRTM-aist/src/lib/coil/common/stringutil.h 2011-08-24 16:34:02 UTC (rev 2227)
@@ -662,6 +662,7 @@
* 文字列リストが空の場合には空白文字を返す。
*
* @param sv CSV変換対象文字列リスト
+ * @param delimiter 接続される文字列の間の文字 (デフォルト: ", ")
*
* @return CSV変換結果文字列
*
@@ -673,12 +674,13 @@
* If the string list is empty, the null will be returned.
*
* @param sv The target string list for creating CSV
+ * @param delimiter Delimiter string between connected words (default: ",")
*
* @return String of CSV creating result
*
* @endif
*/
- std::string flatten(vstring sv);
+ std::string flatten(vstring sv, std::string delimiter = ", ");
/*!
* @if jp
openrtm-commit メーリングリストの案内