egyptionCodeCountry_returnByPlus static method

String egyptionCodeCountry_returnByPlus(
  1. String? str
)

Implementation

static String egyptionCodeCountry_returnByPlus(String? str)
{
  if ( isEmpty( str ) ) {
     return  "";
  }

  String result = "";
  bool isStartWith_002 = str!.startsWith("002");
  if (isStartWith_002) {
  //java to dart
    // String afterRemove002 = str.replace("002", "");
    String afterRemove002 = str.replaceFirst(RegExp(r'002'), '');
    str = afterRemove002;
  }
  String egyptionKeyPhone_plus2 = "+2";
  bool isContainEgytpionKey = str.startsWith(egyptionKeyPhone_plus2);
  if (isContainEgytpionKey) {
    return str;
  }
  result = (egyptionKeyPhone_plus2 + str);
  return result;
}