Java String Ends With endsWithGaps(final byte[] aFrag, final int numEndGaps)

Here you can find the source of endsWithGaps(final byte[] aFrag, final int numEndGaps)

Description

ends With Gaps

License

Apache License

Declaration

public static boolean endsWithGaps(final byte[] aFrag, final int numEndGaps) 

Method Source Code

//package com.java2s;
/*//w w w  . j a va 2 s .  c o m
 * Copyright (c) 2007-2013  David Soergel  <dev@davidsoergel.com>
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 */

public class Main {
    public static boolean endsWithGaps(final byte[] aFrag, final int numEndGaps) {
        for (int i = 1; i <= numEndGaps; i++) {
            // if the fragment is shorter than the window but contains only gaps, return true
            if (i <= 0) {
                return true;
            }
            if (!isGap(aFrag[aFrag.length - i])) {
                return false;
            }
        }
        return true;
    }

    public static boolean isGap(byte x)//, String gapChars)
    {
        return x == '-' || x == '.' || x == ' ';
        //   return gapChars.indexOf((char) x) != -1;
    }
}

Related

  1. endsWithCVC(String str)
  2. endsWithDigit(final String s)
  3. endsWithDoubleConsonent(String str)
  4. endsWithExtension(final String fileName, final String extension)
  5. endsWithFFD9(byte[] data)
  6. endsWithIC(String a, String b)
  7. endsWithIC(String s1, String s2)
  8. endsWithIgnoreCase(final String base, final String end)
  9. endsWithIgnoreCase(final String base, final String end)