viirya commented on code in PR #51710:
URL: https://github.com/apache/spark/pull/51710#discussion_r2241239316


##########
common/utils/src/main/scala/org/apache/spark/util/SparkStringUtils.scala:
##########
@@ -56,6 +56,9 @@ private[spark] trait SparkStringUtils {
     import org.apache.spark.util.ArrayImplicits._
     str.split(",").map(_.trim()).filter(_.nonEmpty).toImmutableArraySeq
   }
+
+  /** Try to strip prefix and suffix with the given string 's' */
+  def strip(str: String, s: String): String = str.stripPrefix(s).stripSuffix(s)

Review Comment:
   StringUtils.strip can handle null properly, I think that is only difference 
here. Since it is used to handle strings in `sys.env("PATH")`, looks like there 
won't be null. But if this will be used in other places, maybe null handle is 
good to add.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to