royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [royale-asjs] branch develop updated: StringUtil remove word method
Date Sat, 09 Jun 2018 20:56:23 GMT
This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new c4236e8  StringUtil remove word method
c4236e8 is described below

commit c4236e864f390b2d2736c2f1fc92a114fb8c98e9
Author: Carlos Rovira <carlosrovira@apache.org>
AuthorDate: Sat Jun 9 22:56:09 2018 +0200

    StringUtil remove word method
---
 .../royale/org/apache/royale/utils/StringUtil.as   | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/StringUtil.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/StringUtil.as
index a8ed294..8e7f6dc 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/StringUtil.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/StringUtil.as
@@ -332,5 +332,29 @@ package org.apache.royale.utils
 			
 			return allowIt;
 		}
+
+		/**
+         *  Removes word from a String and return the new result string
+         *
+         *  @param str The String to be modified. 
+         *  @param wordToSeach The word string to search and remove from str
+         *
+         *  @return <code>String</code> the string without the word
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.3
+         */
+        public static function removeWord(str:String, wordToSeach:String):String
+		{
+			var pos:Number;
+			while(str.search(wordToSeach) > -1)
+			{
+				pos = str.search(wordToSeach);
+				str = str.substring(0, pos) + str.substring(pos + wordToSeach.length, str.length);
+			}
+			return str;
+		}
 	}
 }

-- 
To stop receiving notification emails like this one, please contact
carlosrovira@apache.org.

Mime
View raw message