[Roam-commit] SF.net SVN: roam: [64] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-03-08 07:01:12
|
Revision: 64
http://roam.svn.sourceforge.net/roam/?rev=64&view=rev
Author: jonfroehlich
Date: 2007-03-07 23:01:11 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
added StringUtils.Remove to remove instances of a substring instead a string
Modified Paths:
--------------
Trunk/Source/Roam.Common/Utils/StringUtils.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.Common/Utils/StringUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-03-06 11:57:11 UTC (rev 63)
+++ Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-03-08 07:01:11 UTC (rev 64)
@@ -45,6 +45,22 @@
return str.Trim(new char[] { '\0' });
}
+ public static string Remove(string str, string remove)
+ {
+ int startIndex = str.IndexOf(remove);
+ if (startIndex == -1) { return str; }
+
+ StringBuilder sb = new StringBuilder();
+ while (startIndex != -1)
+ {
+ sb.Append(str.Substring(0, startIndex));
+ str = str.Substring(startIndex + remove.Length, str.Length - (startIndex + remove.Length));
+ startIndex = str.IndexOf(remove);
+ }
+ sb.Append(str);
+ return sb.ToString();
+ }
+
public static string [] ParseWords(string s)
{
char[] whitespace = new char[] { ' ', '\t', '\r', '\n' };
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|