code: public static String subscriptionFromResourceId(String id) {
          return (id != null) ? ResourceId.fromString(id).subscriptionId() : null;
      }
docs: Extract the subscription ID from a resource ID string.
  @param id the resource ID string
  @return the subscription ID