Android String Trim trimScheme(String uri)

Here you can find the source of trimScheme(String uri)

Description

trim Scheme

Declaration

public static String trimScheme(String uri) 

Method Source Code

//package com.java2s;
import android.content.ContentResolver;

public class Main {
    private static final int sSuffixLength = "://".length();
    private static final int sFileSchemeLength = ContentResolver.SCHEME_FILE
            .length();/*from ww  w .j ava2  s  . co  m*/
    private static final int sContentSchemeLength = ContentResolver.SCHEME_CONTENT
            .length();

    public static String trimScheme(String uri) {
        if (uri.regionMatches(0, ContentResolver.SCHEME_FILE, 0,
                sFileSchemeLength)) {
            return uri.substring(sFileSchemeLength + sSuffixLength);
        } else if (uri.regionMatches(0, ContentResolver.SCHEME_CONTENT, 0,
                sContentSchemeLength)) {
            return uri.substring(sContentSchemeLength + sSuffixLength);
        }
        return uri;
    }
}

Related

  1. trim(String str)
  2. trimToNull(String str)
  3. splitAndTrim(String str, String delims)
  4. trimEnd(String s)
  5. nullsafeTrim(String str)
  6. ltrim(final String text)
  7. ltrim(final String text, String trimText)
  8. rtrim(final String text)
  9. rtrim(final String text, String trimText)