Length() 공개 정적인 메소드

public static Length ( byte str ) : int
str byte
리턴 int
예제 #1
0
        public static int Compare(byte *a, int aFrom, byte *b, int bFrom, int count)
        {
            int c = count;
            int aLength = ByteString.Length(a + aFrom), bLength = ByteString.Length(b + bFrom);

            if (count == 0 && aLength != bLength)
            {
                return(aLength - bLength);
            }
            else if (count != 0 && (count > aLength || count > bLength))
            {
                return(aLength - bLength);
            }

            if (c == 0)             // aLen == bLen - filtered at first if
            {
                c = aLength;
            }

            for (int x = 0; x < c; ++x)
            {
                if (x >= c)
                {
                    break;
                }
                if (a [aFrom + x] != b [bFrom + x])
                {
                    return(a [aFrom + x] - b [bFrom + x]);
                }
            }

            return(0);
        }
예제 #2
0
        public void Append(byte *str)
        {
            uint strLength  = (uint)ByteString.Length(str);
            uint thisLength = (uint)this.Length;

            EnsureCapacity(strLength + thisLength);

            Write_INTERNAL(str, strLength);
        }
예제 #3
0
        public static bool GetBytes(string src, byte *dst, int size)
        {
            Diagnostics.Assert(src != null, "ByteString.GetBytes (): argument `src' is null");
            Diagnostics.Assert(dst != null, "ByteString.GetBytes (): argument `dst' is null");
            Diagnostics.Assert(size > 0 && size < ByteString.Length(dst),
                               "ByteString.GetBytes (): argument `size' is out of range");
            Diagnostics.Assert(size >= src.Length, "ByteString.GetBytes (): buffer is too small");

            if (src.Length > size)
            {
                return(false);
            }

            for (int x = 0; x < size; ++x)
            {
                dst [x] = (byte)src [x];
            }

            return(true);
        }
예제 #4
0
 public int Concat(byte *str)
 {
     return(Concat(str, ByteString.Length(str), 0, ByteString.Length(str)));
 }
예제 #5
0
 public int IndexOf(int from, byte *substr, int offset, int count)
 {
     return(IndexOf(from, substr, ByteString.Length(substr), offset, count));
 }