private String parseSectionLine()

in src/main/java/org/ini4j/spi/IniParser.java [109:141]


    private String parseSectionLine(String line, IniSource source, IniHandler handler) throws InvalidFileFormatException
    {
        String sectionName;

      if (line.charAt(line.length() - 1) != SECTION_END)
        {
          int sectionEnd = line.lastIndexOf(SECTION_END);
          String afterSectionEnd = line.substring(sectionEnd + 1).trim();
          if (afterSectionEnd.isEmpty() || isComment(afterSectionEnd.charAt(0)))
          {
            line = line.substring(0, sectionEnd + 1);
          }
          else
          {
            parseError(line, source.getLineNumber());
          }
        }

        sectionName = unescapeKey(line.substring(1, line.length() - 1).trim());
        if ((sectionName.length() == 0) && !getConfig().isUnnamedSection())
        {
            parseError(line, source.getLineNumber());
        }

        if (getConfig().isLowerCaseSection())
        {
            sectionName = sectionName.toLowerCase(Locale.getDefault());
        }

        handler.startSection(sectionName);

        return sectionName;
    }