|
def extract_code_from_mrbts(mrbts): |
|
""" |
|
Extracts the code from a MRBTS (Mobile Radio Base Transceiver Station) string. |
|
|
|
Args: |
|
mrbts (int or str): The MRBTS string to extract the code from. |
|
|
|
Returns: |
|
int: The extracted code from the MRBTS string. |
|
|
|
Raises: |
|
None. |
|
|
|
Notes: |
|
This function handles MRBTS strings that start with '10' and have a length greater than 5, |
|
as well as MRBTS strings that start with '1', '2', or '3'. For MRBTS strings that do not |
|
meet these criteria, the entire MRBTS string is returned as an integer. |
|
""" |
|
str_mrbts = str(mrbts) |
|
|
|
if len(str_mrbts) > 5 and str_mrbts.startswith("10"): |
|
|
|
return int(str_mrbts[2:]) |
|
elif len(str_mrbts) > 4 and str_mrbts.startswith("1"): |
|
return int(str_mrbts[1:]) |
|
elif len(str_mrbts) > 4 and str_mrbts.startswith("2"): |
|
|
|
return int(str_mrbts[1:]) |
|
elif len(str_mrbts) > 4 and str_mrbts.startswith("3"): |
|
|
|
return int(str_mrbts[1:]) |
|
else: |
|
|
|
return int(str_mrbts) |
|
|