public char ConsumeChar() { if (poistion < context.Length()) { char consumedChar = context.CharAt(poistion); poistion++; return(consumedChar); } else { return(CharUtils.ToChar(-1)); } }
public string EncryptBytes(sbyte[] buffer) { Md5Init(); Md5Update(buffer, buffer.Length); Md5Final(); StrBuilder buf = new StrBuilder(); for (int i = 0; i < 16; i++) { buf.Append(CharUtils.ToHex(digest[i])); } return(buf.ToString()); }
private void ReverseAllValidSurrogatePairs() { for (int i = 0; i < _currentIndex - 1; i++) { char c2 = _values[i]; if (CharUtils.IsLowSurrogate(c2)) { char c1 = _values[i + 1]; if (CharUtils.IsHighSurrogate(c1)) { _values[i++] = c1; _values[i] = c2; } } } }
public StrBuilder Reverse() { bool hasSurrogates = false; int n = _currentIndex - 1; for (int j = (n - 1) >> 1; j >= 0; j--) { int k = n - j; char cj = _values[j]; char ck = _values[k]; _values[j] = ck; _values[k] = cj; if (CharUtils.IsSurrogate(cj) || CharUtils.IsSurrogate(ck)) { hasSurrogates = true; } } if (hasSurrogates) { ReverseAllValidSurrogatePairs(); } return(this); }
public char[] RandomArrays() { if (length == 0) { return(new char[0]); } char v = CharUtils.ToChar(-1); char[] newArrays = CollectionUtils.CopyOf(items, length); for (int i = 0; i < length; i++) { v = Random(); for (int j = 0; j < i; j++) { if (newArrays[j] == v) { v = Random(); j = -1; } } newArrays[i] = v; } return(newArrays); }
public override string ToString() { return(new JavaString(CharUtils.ToUNBytes(Base64Coder.Encode(data))).ToString()); }
public byte[] GetUNBytes() { return(CharUtils.ToUNBytes(GetBytes())); }