Text API

Last modified by Admin on 2024/03/19 05:38

cogOffers text-related APIs
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

XWiki 4.0M2+

Installable with the Extension Manager

Description

Features

  • XWikiToStringBuilder: Make it easy to generate a toString() implementation using Commons Lang ToStringBuilder customized to fit XWiki's coding style. For example:
    @Override
    public String toString()
    {
        ToStringBuilder builder = new XWikiToStringBuilder(this);
        builder.append("implementation", getImplementation() == null ? null : getImplementation().getName());
        builder.append("instantiation", getInstantiationStrategy());
       return builder.toString();
    }
  • [since 6.2] org.xwiki.text.StringUtils: extends org.apache.commons.lang3.StringUtils with new useful methods. In 6.2 it comes with:
        /**
         * An attempt to make doubling a character (usually for escaping purposes) as fast as it can be.
         *
         * @param str the string to modify
         * @param c the character to double
         * @return the modified string
         */

       public static String doubleChar(final String str, final char c)

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.commons:xwiki-commons-text 16.1.0):

  • org.apache.commons:commons-lang3 3.14.0
  • org.xwiki.commons:xwiki-commons-stability 16.1.0
Tags:
    

Get Connected