commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TEXT-85) Create CaseUtils class. Add toCamelCase
Date Mon, 12 Jun 2017 12:45:00 GMT

    [ https://issues.apache.org/jira/browse/TEXT-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16046515#comment-16046515
] 

ASF GitHub Bot commented on TEXT-85:
------------------------------------

Github user chtompki commented on a diff in the pull request:

    https://github.com/apache/commons-text/pull/46#discussion_r121374329
  
    --- Diff: src/main/java/org/apache/commons/text/CaseUtils.java ---
    @@ -0,0 +1,140 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.text;
    +
    +import org.apache.commons.lang3.StringUtils;
    +
    +import java.util.HashSet;
    +import java.util.Set;
    +
    +/**
    + * <p>Case manipulation operations on Strings that contain words.</p>
    + *
    + * <p>This class tries to handle <code>null</code> input gracefully.
    + * An exception will not be thrown for a <code>null</code> input.
    + * Each method documents its behaviour in more detail.</p>
    + *
    + * @since 1.0
    + */
    +public class CaseUtils {
    +
    +    /**
    +     * <p><code>CaseUtils</code> instances should NOT be constructed
in
    +     * standard programming. Instead, the class should be used as
    +     * <code>CaseUtils.toCamelCase("foo bar", true, new char[]{'-'});</code>.</p>
    +     * <p>
    +     * <p>This constructor is public to permit tools that require a JavaBean
    +     * instance to operate.</p>
    +     */
    +    public CaseUtils() {
    --- End diff --
    
    You could make the constructor `private`, but I do like the consistency with [`org.apache.commons.lang3.StringUtils.java`](https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/StringUtils.java#L176-L186)


> Create CaseUtils class. Add toCamelCase
> ---------------------------------------
>
>                 Key: TEXT-85
>                 URL: https://issues.apache.org/jira/browse/TEXT-85
>             Project: Commons Text
>          Issue Type: Improvement
>            Reporter: Rob Tompkins
>            Assignee: Rob Tompkins
>
> Based on the conversation here:
> http://markmail.org/message/7nvizsbykvxpr7g5
> We wish to have a {{toCamelCase}} method. The suggestion is to create a {{CaseUtils}}
class.
> I wonder if we should think about deprecating the case management in {{WordUtils}} and
move it over? Maybe, maybe not.
> I would think our method signature would look something like:
> {code}
> String toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)
> {code}
> potentially with {{String}} replaced with {{CharSequence}}.
> Lastly, {{WordUtils.capitalizeFully(String str, final char... delimiters)}} might be
a good starting point. https://github.com/apache/commons-text/blob/master/src/main/java/org/apache/commons/text/WordUtils.java#L467-L499



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message