/** * Constructs a LangString using the given label and language. * * @param label * @param language * @return a LangString with the given label and language */ public static LangString valueOf(String label, String language) { return new LangString(label, language); }
/** * Constructs a LangString using the default {@link Locale} for the * language. * * @param label * @return a LangString with the given label and a default language */ public static LangString valueOf(String label) { return new LangString(label); }
/** * Constructs a LangString using the given label and language. * * @param label * @param language * @return a LangString with the given label and language */ public static LangString valueOf(String label, String language) { return new LangString(label, language); }
/** * Constructs a LangString using the default {@link Locale} for the * language. * * @param label * @return a LangString with the given label and a default language */ public static LangString valueOf(String label) { return new LangString(label); }
public T deserialize(Literal literal) { String lang = literal.getLanguage(); if (lang == null) return type.cast(literal.getLabel()); return type.cast(new LangString(literal.getLabel(), lang)); }
public T deserialize(Literal literal) { String lang = literal.getLanguage(); if (lang == null) return type.cast(literal.getLabel()); return type.cast(new LangString(literal.getLabel(), lang)); }
/** * Replaces each substring of this string that matches the literal target * sequence with the specified literal replacement sequence. The replacement * proceeds from the beginning of the string to the end, for example, * replacing "aa" with "b" in the string "aaa" will result in "ba" rather * than "ab". * * @param target * The sequence of char values to be replaced * @param replacement * The replacement sequence of char values * @return The resulting string * @throws NullPointerException * if <code>target</code> or <code>replacement</code> is * <code>null</code>. */ public LangString replace(CharSequence target, CharSequence replacement) { return new LangString(toString().replace(target, replacement), getLang()); }
/** * Replaces each substring of this string that matches the literal target * sequence with the specified literal replacement sequence. The replacement * proceeds from the beginning of the string to the end, for example, * replacing "aa" with "b" in the string "aaa" will result in "ba" rather * than "ab". * * @param target * The sequence of char values to be replaced * @param replacement * The replacement sequence of char values * @return The resulting string * @throws NullPointerException * if <code>target</code> or <code>replacement</code> is * <code>null</code>. */ public LangString replace(CharSequence target, CharSequence replacement) { return new LangString(toString().replace(target, replacement), getLang()); }
/** * Returns a new string that is a substring of this string. The substring * begins with the character at the specified index and extends to the end * of this string. * <p> * Examples: <blockquote> * * <pre> * "unhappy".substring(2) returns "happy" * "Harbison".substring(3) returns "bison" * "emptiness".substring(9) returns "" (an empty string) * </pre> * * </blockquote> * * @param beginIndex * the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException * if <code>beginIndex</code> is negative or larger than the * length of this <code>String</code> object. */ public LangString substring(int beginIndex) { return new LangString(toString().substring(beginIndex), getLang()); }
/** * Concatenates the specified string to the end of this string. * <p> * If the length of the argument string is <code>0</code>, then this * <code>String</code> object is returned. Otherwise, a new * <code>String</code> object is created, representing a character sequence * that is the concatenation of the character sequence represented by this * <code>String</code> object and the character sequence represented by the * argument string. * <p> * Examples: <blockquote> * * <pre> * "cares".concat("s") returns "caress" * "to".concat("get").concat("her") returns "together" * </pre> * * </blockquote> * * @param str * the <code>String</code> that is concatenated to the end of * this <code>String</code>. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. */ public LangString concat(String str) { return new LangString(toString().concat(str), getLang()); }
/** * Returns a new string that is a substring of this string. The substring * begins with the character at the specified index and extends to the end * of this string. * <p> * Examples: <blockquote> * * <pre> * "unhappy".substring(2) returns "happy" * "Harbison".substring(3) returns "bison" * "emptiness".substring(9) returns "" (an empty string) * </pre> * * </blockquote> * * @param beginIndex * the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException * if <code>beginIndex</code> is negative or larger than the * length of this <code>String</code> object. */ public LangString substring(int beginIndex) { return new LangString(toString().substring(beginIndex), getLang()); }
/** * Concatenates the specified string to the end of this string. * <p> * If the length of the argument string is <code>0</code>, then this * <code>String</code> object is returned. Otherwise, a new * <code>String</code> object is created, representing a character sequence * that is the concatenation of the character sequence represented by this * <code>String</code> object and the character sequence represented by the * argument string. * <p> * Examples: <blockquote> * * <pre> * "cares".concat("s") returns "caress" * "to".concat("get").concat("her") returns "together" * </pre> * * </blockquote> * * @param str * the <code>String</code> that is concatenated to the end of * this <code>String</code>. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. */ public LangString concat(String str) { return new LangString(toString().concat(str), getLang()); }
/** * Returns a new string that is a substring of this string. The substring * begins at the specified <code>beginIndex</code> and extends to the * character at index <code>endIndex - 1</code>. Thus the length of the * substring is <code>endIndex-beginIndex</code>. * <p> * Examples: <blockquote> * * <pre> * "hamburger".substring(4, 8) returns "urge" * "smiles".substring(1, 5) returns "mile" * </pre> * * </blockquote> * * @param beginIndex * the beginning index, inclusive. * @param endIndex * the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException * if the <code>beginIndex</code> is negative, or * <code>endIndex</code> is larger than the length of this * <code>String</code> object, or <code>beginIndex</code> is * larger than <code>endIndex</code>. */ public LangString substring(int beginIndex, int endIndex) { return new LangString(toString().substring(beginIndex, endIndex), getLang()); }
/** * Returns a new string that is a substring of this string. The substring * begins at the specified <code>beginIndex</code> and extends to the * character at index <code>endIndex - 1</code>. Thus the length of the * substring is <code>endIndex-beginIndex</code>. * <p> * Examples: <blockquote> * * <pre> * "hamburger".substring(4, 8) returns "urge" * "smiles".substring(1, 5) returns "mile" * </pre> * * </blockquote> * * @param beginIndex * the beginning index, inclusive. * @param endIndex * the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException * if the <code>beginIndex</code> is negative, or * <code>endIndex</code> is larger than the length of this * <code>String</code> object, or <code>beginIndex</code> is * larger than <code>endIndex</code>. */ public LangString substring(int beginIndex, int endIndex) { return new LangString(toString().substring(beginIndex, endIndex), getLang()); }
return new LangString(toString().trim(), getLang());
return new LangString(toString().trim(), getLang());
return new LangString(toString().replace(oldChar, newChar), getLang());
return new LangString(toString().substring(start, end), getLang());
return new LangString(toString().replace(oldChar, newChar), getLang());
return new LangString(toString().replaceAll(regex, replacement), getLang());