scripts: kconfig: Add substring function

Adds a substring function

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py
index a74b080..58fcf9c 100644
--- a/scripts/kconfig/kconfigfunctions.py
+++ b/scripts/kconfig/kconfigfunctions.py
@@ -866,6 +866,16 @@
     return "y" if shield in list.split(";") else "n"
 
 
+def substring(kconf, _, string, start, stop=None):
+    """
+    Extracts a portion of the string, removing characters from the front, back or both.
+    """
+    if stop is not None:
+        return string[int(start):int(stop)]
+    else:
+        return string[int(start):]
+
+
 # Keys in this dict are the function names as they appear
 # in Kconfig files. The values are tuples in this form:
 #
@@ -921,4 +931,5 @@
         "dt_chosen_partition_addr_hex": (dt_chosen_partition_addr, 1, 3),
         "normalize_upper": (normalize_upper, 1, 1),
         "shields_list_contains": (shields_list_contains, 1, 1),
+        "substring": (substring, 2, 3),
 }