Posts

Showing posts from May, 2015

Java program to check if a string is pangram

Hi everyone, in this blog, I will be writing about a java program to check whether a string is pangram or not. Pangrams are words or sentences containing every letter of alphabet at least once. Most commonly used example of pangram is " A quick brown fox jumps over the lazy dog. " Logic of the program Initialize a string testString as "abcdefghijklmnopqrstuvwxyz" Loop the input string for every character, and replace those character in testString with empty character. If testString is an empty string, then input string is Pangram The program for pangram is as follows: package com.blog.techjourney; public class Pangram { public static Boolean checkForPangram(String str) { int len = str.length(); //test string for testing all characters are present in the given string String testString = "abcdefghijklmnopqrstuvwxyz" ; for ( int i=0;i<len;i++) { char chars =str.charAt(i); //Converting the char to String a