Java String Sanitize sanitizeGoogleId(String rawGoogleId)

Here you can find the source of sanitizeGoogleId(String rawGoogleId)

Description

Sanitizes a google ID by removing leading/trailing whitespace and the trailing "@gmail.com".

License

Open Source License

Return

the sanitized google ID or null (if the parameter was null).

Declaration

public static String sanitizeGoogleId(String rawGoogleId) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*  w w  w  .  j a v  a 2  s .  c  o  m*/
     * Sanitizes a google ID by removing leading/trailing whitespace
     * and the trailing "@gmail.com".
     *
     * @return the sanitized google ID or null (if the parameter was null).
     */
    public static String sanitizeGoogleId(String rawGoogleId) {
        if (rawGoogleId == null) {
            return null;
        }

        String sanitized = rawGoogleId.trim();
        if (sanitized.toLowerCase().endsWith("@gmail.com")) {
            sanitized = sanitized.split("@")[0];
        }
        return sanitized.trim();
    }
}

Related

  1. sanitizeForSearch(String str)
  2. sanitizeForSemgrexName(String text)
  3. sanitizeForTableName(String input)
  4. sanitizeForUri(String uri, String replace)
  5. sanitizeFullPrefixKey(String propKey)
  6. sanitizeHeader(String header)
  7. sanitizeID(String name)
  8. sanitizeIdentifier(String identifier)
  9. sanitizeIdentifierName(String input)