Java Array Search memchr(char[] haystack, int offset, char needle, int num)

Here you can find the source of memchr(char[] haystack, int offset, char needle, int num)

Description

memchr

License

Open Source License

Declaration

private static int memchr(char[] haystack, int offset, char needle, int num) 

Method Source Code

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

public class Main {
    private static int memchr(char[] haystack, int offset, char needle, int num) {

        if (num != 0) {
            int p = 0;

            do {/*from  w  w w .  j  a  va  2s .  co  m*/

                if (haystack[offset + p] == needle)
                    return 1;

                p++;

            } while (--num != 0);

        }
        return 0;

    }
}

Related

  1. isIn(String name, String[] array)
  2. isIn(String name, String[] array)
  3. isInArray(final T ch, final T[] a)
  4. isInArray(String needle, String[] haystack)
  5. memchr(boolean[] ary, int start, int len, boolean find)
  6. memchr(T[] ptr, T value)
  7. replaceAll(String text, char[] toSearch, char toReplace)
  8. search(double[] input, int[] bounds, double x)
  9. Search(int[] in, int val)