/** * Sets the script. * * <p>See RFC 5646 section 2.2.3. * * @param script The script, as a four-letter ISO 15924 code. * {@code null} if not defined. * * @throws LangTagException If the script syntax is invalid. */ public void setScript(final String script) throws LangTagException { if (script == null) { this.script = null; return; } ensureMaxLength(script); if (! isScript(script)) throw new LangTagException("Invalid script subtag: Must be a four-letter ISO 15924 code"); this.script = script.substring(0, 1).toUpperCase() + script.substring(1).toLowerCase(); }
if (pos < subtags.length && isScript(subtags[pos])) langTag.setScript(subtags[pos++]);