[mlpack-svn] r16189 - mlpack/trunk/src/mlpack/core/util

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jan 28 17:30:27 EST 2014


Author: rcurtin
Date: Tue Jan 28 17:30:27 2014
New Revision: 16189

Log:
Don't make an extra line when indenting things.


Modified:
   mlpack/trunk/src/mlpack/core/util/string_util.cpp

Modified: mlpack/trunk/src/mlpack/core/util/string_util.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/util/string_util.cpp	(original)
+++ mlpack/trunk/src/mlpack/core/util/string_util.cpp	Tue Jan 28 17:30:27 2014
@@ -24,6 +24,10 @@
   size_t startPos = 0;
   while ((startPos = input.find("\n", startPos)) != string::npos)
   {
+    // Don't replace the last newline.
+    if (startPos == input.length() - 1)
+      break;
+
     input.replace(startPos, 1, tabbedNewline);
     startPos += tabbedNewline.length();
   }



More information about the mlpack-svn mailing list