iTextSharp.text.pdf.Barcode128.GetHumanReadableUCCEAN C# (CSharp) Method

GetHumanReadableUCCEAN() public static method

public static GetHumanReadableUCCEAN ( String code ) : String
code String
return String
        public static String GetHumanReadableUCCEAN(String code) {
            StringBuilder buf = new StringBuilder();
            String fnc1 = FNC1.ToString();
            try {
                while (true) {
                    if (code.StartsWith(fnc1)) {
                        code = code.Substring(1);
                        continue;
                    }
                    int n = 0;
                    int idlen = 0;
                    for (int k = 2; k < 5; ++k) {
                        if (code.Length < k)
                            break;
                        if ((n = ais[int.Parse(code.Substring(0, k))]) != 0) {
                            idlen = k;
                            break;
                        }
                    }
                    if (idlen == 0)
                        break;
                    buf.Append('(').Append(code.Substring(0, idlen)).Append(')');
                    code = code.Substring(idlen);
                    if (n > 0) {
                        n -= idlen;
                        if (code.Length <= n)
                            break;
                        buf.Append(RemoveFNC1(code.Substring(0, n)));
                        code = code.Substring(n);
                    }
                    else {
                        int idx = code.IndexOf(FNC1);
                        if (idx < 0)
                            break;
                        buf.Append(code.Substring(0,idx));
                        code = code.Substring(idx + 1);
                    }
                }
            }
            catch {
                //empty
            }
            buf.Append(RemoveFNC1(code));
            return buf.ToString();
        }