String conversion to array

xiaoxiao2021-03-06  73

/ ** * Convert a string to the length array of LEN length, not enough to fix / 0 * @Param astr string * @Param Len Byte array length * @return byte array * / public static Byte [] stringtes (String " Astr, int LEN) {IF (Strutil.isempty (astr)) astr = ""; if (astr.Length ()> LEN) throw new indexoutofboundsexception ("Astr Len:" astr.length () ">" Len;

Byte result [] = new byte [len]; system.Arraycopy (astr.getbytes (), 0, result, 0, astr.getbytes (). Length); Return Result;}

转载请注明原文地址:https://www.9cbs.com/read-93378.html

New Post(0)