System.util.StringTokenizer.NextToken C# (CSharp) Method

NextToken() public method

public NextToken ( ) : String
return String
        public String NextToken()
        {
            if (pos < len && delim.IndexOf(str[pos]) >= 0) {
                if (retDelims)
                    return str.Substring(pos++, 1);
                while (++pos < len && delim.IndexOf(str[pos]) >= 0);
            }
            if (pos < len) {
                int start = pos;
                while (++pos < len && delim.IndexOf(str[pos]) < 0);

                return str.Substring(start, pos - start);
            }
            throw new IndexOutOfRangeException();
        }

Same methods

StringTokenizer::NextToken ( String delim ) : String

Usage Example

Esempio n. 1
0
 static GlyphList()
 {
     Stream istr = null;
     try {
         istr = BaseFont.GetResourceStream("glyphlist.txt");
         if (istr == null) {
            string msg = string.Format("glyphlist.txt not found as resource. (path: {0})", BaseFont.RESOURCE_PATH);
            throw new Exception(msg);
         }
         byte[] buf = new byte[1024];
         MemoryStream outp = new MemoryStream();
         while (true) {
             int size = istr.Read(buf, 0, buf.Length);
             if (size == 0)
                 break;
             outp.Write(buf, 0, size);
         }
         istr.Close();
         istr = null;
         String s = PdfEncodings.ConvertToString(outp.ToArray(), null);
         StringTokenizer tk = new StringTokenizer(s, "\r\n");
         while (tk.HasMoreTokens()) {
             String line = tk.NextToken();
             if (line.StartsWith("#"))
                 continue;
             StringTokenizer t2 = new StringTokenizer(line, " ;\r\n\t\f");
             String name = null;
             String hex = null;
             if (!t2.HasMoreTokens())
                 continue;
             name = t2.NextToken();
             if (!t2.HasMoreTokens())
                 continue;
             hex = t2.NextToken();
             int num = int.Parse(hex, NumberStyles.HexNumber);
             unicode2names[num] = name;
             names2unicode[name] = new int[]{num};
         }
     }
     catch (Exception e) {
         Console.Error.WriteLine("glyphlist.txt loading error: " + e.Message);
     }
     finally {
         if (istr != null) {
             try {
                 istr.Close();
             }
             catch {
                 // empty on purpose
             }
         }
     }
 }
All Usage Examples Of System.util.StringTokenizer::NextToken