summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jun Yin <junyin@google.com> 2018-01-24 12:13:37 -0800
committer Jun Yin <junyin@google.com> 2018-01-24 12:33:05 -0800
commitb40a26c43d30f475682b59dbbe404bae932b68b0 (patch)
tree4a4c82f61511fa8372b9c0ef28267bba59a3a318
parent2a8c24be18dfc3d7cb3f405bee898613b23a212e (diff)
Adds stripTrailingFs
This function removes padding 'F' characters in a string (e.g., ICCID). Bug: 38206971 Test: unit test in another cl Change-Id: If77604576c5bd26404cdc436f8297191664325a4
-rw-r--r--telephony/java/com/android/internal/telephony/uicc/IccUtils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
index 9f8b3a822c81..c0954385a0a3 100644
--- a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
+++ b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
@@ -837,6 +837,13 @@ public class IccUtils {
}
/**
+ * Strip all the trailing 'F' characters of a string, e.g., an ICCID.
+ */
+ public static String stripTrailingFs(String s) {
+ return s == null ? null : s.replaceAll("(?i)f*$", "");
+ }
+
+ /**
* Converts a character of [0-9a-aA-F] to its hex value in a byte. If the character is not a
* hex number, 0 will be returned.
*/