java_src/src/main/java/com/google/crypto/tink/subtle/Validators.java
/**
   * Validates that {@code kmsKeyUri} starts with {@code expectedPrefix}, and removes the prefix.
   *
   * @throws IllegalArgumentException if {@code kmsKeyUri} is invalid.
   */
Validates that  kmsKeyUri starts with  expectedPrefix, and removes the prefix.
Validates that kmsKeyUri starts with expectedPrefix and removes the prefix .
public static String validateKmsKeyUriAndRemovePrefix(String expectedPrefix, String kmsKeyUri) {
    if (!kmsKeyUri.toLowerCase(Locale.US).startsWith(expectedPrefix)) {
      throw new IllegalArgumentException(
          String.format("key URI must start with %s", expectedPrefix));
    }
    return kmsKeyUri.substring(expectedPrefix.length());
  }
public static String validateKmsKeyUriAndRemovePrefix ( String expectedPrefix , String kmsKeyUri ) { if ( ! kmsKeyUri . toLowerCase ( Locale . US ) . startsWith ( expectedPrefix ) ) { throw new IllegalArgumentException ( String . format ( "key URI must start with %s" , expectedPrefix ) ) ; } return kmsKeyUri . substring ( expectedPrefix . length ( ) ) ; }
Validates that {@code kmsKeyUri} starts with {@code expectedPrefix}, and removes the prefix.
Validates that { @code kmsKeyUri } starts with { @code expectedPrefix } and removes the prefix .