You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2019/12/29 11:26:27 UTC
[royale-asjs] branch develop updated: Get rid of StringUtil and use
util function instead
This is an automated email from the ASF dual-hosted git repository.
harbs 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 2128f1e Get rid of StringUtil and use util function instead
2128f1e is described below
commit 2128f1e499b0a6ec29059f165b7b5ab708031399
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Dec 29 13:25:47 2019 +0200
Get rid of StringUtil and use util function instead
---
.../projects/Core/src/main/royale/CoreClasses.as | 1 +
.../org/apache/royale/core/SimpleCSSValuesImpl.as | 4 +-
.../org/apache/royale/utils/string/splitAndTrim.as | 54 ++++++++++++++++++++++
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 1cc8c29..a2ae8d2 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -305,6 +305,7 @@ internal class CoreClasses
import org.apache.royale.utils.string.contains; contains;
import org.apache.royale.utils.string.isWhitespace; isWhitespace;
import org.apache.royale.utils.string.trim; trim;
+ import org.apache.royale.utils.string.splitAndTrim; splitAndTrim;
import org.apache.royale.utils.string.trimRight; trimRight;
import org.apache.royale.utils.string.trimLeft; trimLeft;
import org.apache.royale.utils.string.cacheBust; cacheBust;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/SimpleCSSValuesImpl.as
index 50ef164..b703b46 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/SimpleCSSValuesImpl.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/SimpleCSSValuesImpl.as
@@ -35,7 +35,7 @@ package org.apache.royale.core
import org.apache.royale.events.ValueEvent;
import org.apache.royale.geom.Rectangle;
import org.apache.royale.utils.CSSUtils;
- import org.apache.royale.utils.StringUtil;
+ import org.apache.royale.utils.string.splitAndTrim;
/**
* The SimpleCSSValuesImpl class implements a minimal set of
@@ -667,7 +667,7 @@ package org.apache.royale.core
var parts:Array = styles.split(";");
for each (var part:String in parts)
{
- var pieces:Array = StringUtil.splitAndTrim(part, ":");
+ var pieces:Array = splitAndTrim(part, ":");
if (pieces.length < 2) continue;
var valueName:String = pieces[0];
var c:int = valueName.indexOf("-");
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/splitAndTrim.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/splitAndTrim.as
new file mode 100644
index 0000000..4dd1a25
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/splitAndTrim.as
@@ -0,0 +1,54 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.string
+{
+ /**
+ * Removes all whitespace characters from the beginning and end
+ * of each element in an Array, where the Array is stored as a String.
+ *
+ * @param value The String whose whitespace should be trimmed.
+ *
+ * @param separator The String that delimits each Array element in the string.
+ *
+ * @return Array where whitespace was removed from the
+ * beginning and end of each element.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function splitAndTrim(value:String, delimiter:String):Array
+ {
+ if (value != "" && value != null)
+ {
+ var items:Array = value.split(delimiter);
+
+ var len:int = items.length;
+ for (var i:int = 0; i < len; i++)
+ {
+ items[i] = trim(items[i]);
+ }
+ return items;
+ }
+
+ return [];
+ }
+}
+