Here you can find the source of minChar(String input)
String
object.
Parameter | Description |
---|---|
input | - The input <code>String</code> object. |
public static int minChar(String input)
//package com.java2s; /**/*ww w. j a v a 2 s . co m*/ * Copyright (C) 2015-2016 OurBeehive(http://ourbeehive.github.io/) * * Licensed 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. * Project Name: MyBatisPioneer * File Name: StringHelper.java * Package Name: org.ourbeehive.mbp.util * * Date: Jan 20, 2016 * Author: Sericloud * */ public class Main { /** * Get the minimum character within the <code>String</code> object. * * @param input * - The input <code>String</code> object. * @return int */ public static int minChar(String input) { if (input == null) { throw new NullPointerException(); } int min = 0; int len = input.length(); int ch = 0; for (int i = 0; i < len; i++) { ch = input.charAt(i); if (ch < min) { min = ch; } } return min; } }