Convert Password to String





8
Date Submitted Fri. Feb. 24th, 2006 8:18 PM
Revision 2 of 2
Coder mattrmiller
Tags Java | JPasswordField | Password | String
Comments 2 comments
Convert a password returned by JPasswordField::getPassword() into a String.


        // Convert password to string
        public static String convertPassword(char[] cPassword)
        {
                // Declare variables
                String strRet = new String("");
               
                // Go through each character
                for (int i = 0; i < cPassword.length; i++)
                {
                        strRet += cPassword[i];
                }
               
                return strRet;
        }

 

Matthew R. Miller

www.bluecreststudios.com
=================
Matthew R. Miller

http://bluecreststudios.com
http://www.codeandcoffee.com

Comments

Comments Easier Way
Mon. Feb. 27th, 2006 4:52 AM    Scripter TimYates
  Comments Another method
Tue. Sep. 26th, 2006 2:56 PM    Beginner jonathanstarrett

Voting