Java String Capitalize capitalizedArray(String[] sstr)

Here you can find the source of capitalizedArray(String[] sstr)

Description

check each word in the given string array is capitalized or not Input: array of strings Output: U U L L U L U L L L U L....

License

Apache License

Declaration

public static String[] capitalizedArray(String[] sstr) 

Method Source Code

//package com.java2s;
/**//from w w  w  .j  a v a 2  s.com
   * 
  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.
   * 
   * @author Wei Zhang,  Language Technology Institute, School of Computer Science, Carnegie-Mellon University.
   * email: wei.zhang@cs.cmu.edu
   * 
   */

public class Main {
    /**
       * check each word in the given string array is capitalized or not Input: array of strings Output:
       * U U L L U L U L L L U L....
       */
    public static String[] capitalizedArray(String[] sstr) {
        String[] cap = new String[sstr.length];
        int i = 0;
        for (String s : sstr) {
            if (Character.isUpperCase(s.charAt(0)))
                cap[i] = "U";
            else
                cap[i] = "L";
            i++;
        }
        return cap;
    }
}

Related

  1. capitalizeClass(String className)
  2. capitalized(String s)
  3. capitalized(String s)
  4. capitalized(String str)
  5. capitalizeD(String str, char[] delimiters)
  6. capitalizedCase(CharSequence source, char... delimiters)
  7. capitalizedName(final String property)
  8. capitalizeFirst(CharSequence str)
  9. capitalizeFormat(String string)