Android String Sub String Get subStringEndString(String sourceStr, String endString)

Here you can find the source of subStringEndString(String sourceStr, String endString)

Description

sub String End String

Declaration

public static String subStringEndString(String sourceStr,
        String endString) 

Method Source Code

//package com.java2s;

public class Main {

    public static String subStringEndString(String sourceStr,
            String endString) {//from ww w .j  av  a  2s. c  o m

        int position = sourceStr.indexOf(endString);
        if (position == -1) {
            return sourceStr;
        }

        String newString = sourceStr.substring(0, position);
        return newString;
    }
}

Related

  1. unicodePreservingSubstring(String paramString, int paramInt1, int paramInt2)
  2. unicodePreservingSubstring(String str, int begin, int end)
  3. unicodePreservingSubstring(String str, int begin)
  4. substringAfter(String str, String separator)
  5. substringBetween(String str, String open, String close)
  6. hightLinghtString(String destStr, String subStr, int color)
  7. replace(String source, String subject, String object)
  8. replaceOnce(String source, String subject, String object)
  9. substring(String str, int toCount)