Removes spaces (char <= 32) from start of this String, handling null by returning null : String ASCII « Data Type « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Data Type » String ASCII 




Removes spaces (char <= 32) from start of this String, handling null by returning null
  

/*
 *  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. 
 *  
 */



/**
 * Various string manipulation methods that are more efficient then chaining
 * string operations: all is done in the same buffer without creating a bunch of
 * string objects.
 
 @author <a href="mailto:dev@labs.apache.org">Dungeon Project</a>
 */
public class Main {

  /**
   * <p>
   * Removes spaces (char &lt;= 32) from start of this String, handling
   * <code>null</code> by returning <code>null</code>.
   * </p>
   * Trim removes start characters &lt;= 32.
   
   * <pre>
   *  StringUtils.trimLeft(null)          = null
   *  StringUtils.trimLeft(&quot;&quot;)            = &quot;&quot;
   *  StringUtils.trimLeft(&quot;     &quot;)       = &quot;&quot;
   *  StringUtils.trimLeft(&quot;abc&quot;)         = &quot;abc&quot;
   *  StringUtils.trimLeft(&quot;    abc    &quot;) = &quot;abc    &quot;
   * </pre>
   
   @param str
   *            the String to be trimmed, may be null
   @return the trimmed string, <code>null</code> if null String input
   */
  public static final String trimLeftString str )
  {
      if isEmptystr ) )
      {
          return "";
      }

      int start = 0;
      int end = str.length();
      
      while ( ( start < end && str.charAtstart == ' ' ) )
      {
          start++;
      }

      return start == ? str : str.substringstart ) );
  }
  /**
   * <p>
   * Checks if a String is empty ("") or null.
   * </p>
   
   * <pre>
   *  StringUtils.isEmpty(null)      = true
   *  StringUtils.isEmpty(&quot;&quot;)        = true
   *  StringUtils.isEmpty(&quot; &quot;)       = false
   *  StringUtils.isEmpty(&quot;bob&quot;)     = false
   *  StringUtils.isEmpty(&quot;  bob  &quot;) = false
   * </pre>
   
   * <p>
   * NOTE: This method changed in Lang version 2.0. It no longer trims the
   * String. That functionality is available in isBlank().
   * </p>
   
   @param str
   *            the String to check, may be null
   @return <code>true</code> if the String is empty or null
   */
  public static final boolean isEmptyString str )
  {
      return str == null || str.length() == 0;
  }
}

   
    
  














Related examples in the same category
1.Checks whether the character is ASCII 7 bit.
2.Checks whether the character is ASCII 7 bit printable.
3.Checks whether the character is ASCII 7 bit control.
4.Checks whether the character is ASCII 7 bit alphabetic.
5.Checks whether the character is ASCII 7 bit alphabetic upper case.
6.Checks whether the character is ASCII 7 bit alphabetic lower case.
7.Checks whether the character is ASCII 7 bit numeric.
8.Checks whether the character is ASCII 7 bit numeric and character.
9.Allow text containing mostly ASCII characters to be decipherable on an ASCII terminal without decoding.
10.Removes control characters (char <= 32) from both ends returning null if the String is empty ("") after the trim or if it is null
11.Removes control characters (char <= 32) from both ends returning an empty String ("") if the String is empty ("") after the trim or if it is null.
12.Get 7-bit ASCII character array from input String.
13.Test if the character is a digit <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
14.Test if the current character is a digit <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
15.Test if the current character is a new line.
16.Test if the current character is a space.
17.Test if the current character is an Alpha character : <alpha> ::= [0x41-0x5A] | [0x61-0x7A]
18.Test if the current character is an Ident character
19.Test if the current character is equal to a specific character.
20.Test if the current string is a digit <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
21.Removes spaces (char <= 32) from both start and ends of this bytes array
22.Removes spaces (char <= 32) from end of this String with escape, handling null by returning null
23.Removes spaces (char <= 32) from end of this String, handling null by returning null
24.Removes spaces (char <= 32) from end of this array by index, handling null by returning null
25.Removes spaces (char <= 32) from end of this array ny position, handling null by returning null
26.Removes spaces (char <= 32) from end of this array, handling null by returning null
27.Removes spaces (char <= 32) from start of this array, handling null by returning null
28.Thansform an array of ASCII bytes to a string. the byte array should contains only values in [0, 127].
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.