Java String Sanitize sanitizePath(String apiPath)

Here you can find the source of sanitizePath(String apiPath)

Description

This sanitizes an API path.

License

Apache License

Parameter

Parameter Description
apiPath The api path to sanitize

Return

The sanitized path

Declaration

public static String sanitizePath(String apiPath) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from  w  w  w . j  a va2 s . c o  m
     * This sanitizes an API path. It handles removing regex path expressions
     * e.g instead of /api/test/{id:[0-9]+} it will return /api/test/{id}
     * @param apiPath The api path to sanitize
     * @return The sanitized path
     */
    public static String sanitizePath(String apiPath) {
        return apiPath.replaceAll("[: ]+.*?}", "}");
    }
}

Related

  1. sanitizeName(String origName)
  2. sanitizeNamespace(String namespace)
  3. sanitizeOperationId(String operationId)
  4. sanitizePackageName(String raw)
  5. sanitizePackageVersion(String string)
  6. sanitizePath(String input)
  7. sanitizePrimitives(Class clazz)
  8. sanitizeProcOrFuncName(String src)
  9. sanitizeProjectName(final String projectName)