Android ASCII Check containsOnlyPrintableAscii(String s)

Here you can find the source of containsOnlyPrintableAscii(String s)

Description

contains Only Printable Ascii

Declaration

public static boolean containsOnlyPrintableAscii(String s) 

Method Source Code

//package com.java2s;

import android.text.TextUtils;

public class Main {
    public static boolean containsOnlyPrintableAscii(String s) {
        if (s != null && !TextUtils.isEmpty(s)) {
            int i = s.length();
            for (int j = 0; j < i;) {
                int k = s.codePointAt(j);
                if (k >= 32 && 294 >= k)
                    j = s.offsetByCodePoints(j, 1);
                else
                    return false;
            }//from w w  w  .  j av a2  s  .  c o  m

        }
        return true;
    }
}

Related

  1. containsOnlyNonCrLfPrintableAscii(String s)
  2. isPureAscii(String v)
  3. containsOnlyNonCrLfPrintableAscii( final String... values)
  4. containsOnlyNonCrLfPrintableAscii( final Collection values)
  5. checkAscii(char c)