CONVERT TEXT(STRING) INTO CHARACTER CODE_




Text to Character converter.

Hi in this program i have shown you how to convert any string into its respective character code.
Feel free to copy this code.
Created using Bluej.
to contact me: EMAIL


code:-

import java.util.*;
class convert
{
    String conv(String nm)
    {
        int k,i;
        String w="";
        int n;
        
        nm=nm.trim();
        nm=nm.toUpperCase();
        k=nm.length();
        
        for(i=0;i<k;i++)
        {
            n=nm.charAt(i);
            w=w+n;
        }
        
        return w;
    }
    
    public static void main ( String args[])
    {
        Scanner sc = new Scanner(System.in);
        String nm;
        System.out.println("String:-");
        nm=sc.nextLine();
        
        convert mm= new convert();
        System.out.println("character code:- "+(mm.conv(nm)));
    }
}

Post a Comment

2 Comments

Please follow the moderation policy before writing annotations