ICSE Project
Accessory Programs
These Programs are meant to help you
develop your project by easing the trouble to type less and progress more.
If you have any suggestions about what
other kind of Programs might ease out the trouble of developing programs, I
will be delighted and will try my best to tackle the problem.
I. Program to convert text to Ascii
java System.out.println() format. Just go to Patorjk and type the text you want to display in Ascii Art. Then count and enter the Number of lines your art has and paste the line one by one and you will get the System.out.println() format of the art.
import java.util.Scanner;
class AsciiToJava
{
Scanner S = new
Scanner(System.in);
public void main()
{
Scanner SC = new
Scanner(System.in);
System.out.println("Enter the no of lines");
int nol =
S.nextInt();
String ascii[] = new
String[nol];
String kscii[] = new
String[nol];
for(int i = 0;
i<nol;i++)
{
System.out.println("Enter "+(i+1)+"th Line");
ascii[i] =
SC.nextLine();
kscii[i] = "";
for(int o =
0;o<ascii[i].length();o++)
{
kscii[i] =
kscii[i] + ascii[i].charAt(o);
if(ascii[i].charAt(o)=='\\')
kscii[i] =
kscii[i] + '\\';
}
}
for(int j =0;j<nol;j++)
System.out.println("System.out.println(\"
"+kscii[j]+"\");");
}
}
I personally found it confusing to work with StringTokenizer class Objects so I have defined a method to convert tokenizer to array.
String[] Tokenizer_To_Array(StringTokenizer
s1)
{
String
result[] = new String[s1.countTokens()];
int n1 =
s1.countTokens();
for(int
i=0;i<n1;i++)
result[i] = s1.nextToken();
return
result;
}