Results 1 to 2 of 2
  1. #1
    SmokeyWoody is offline Member
    Join Date
    Oct 2014
    Posts
    36
    Rep Power
    0

    Default Help with setting a String using if

    Here are two codes that I am using but I have one that just doesn't work for some reason and the other does. Encode doesn't work. I don't need the Character.isAlphabetic for encode but not sure what I can use with 'if' to set the String encodedString. What could be wrong? I have no idea...

    Java Code:
    private String prepareString(String plainText)
       {
          String preparedString = "";
          for(int i = 0 ; i < plainText.length();i++)
          if(Character.isAlphabetic(plainText.charAt(i)))
          {
             preparedString = preparedString+Character.toUpperCase(plainText.charAt(i));        
          }
          return preparedString;
       }
    Java Code:
    public String encode(String plainText)  
       {
          int prepareString;
          int shiftChar;
          String preparedString2 = prepareString(plainText);
          
          String encodedString = ""; 
          for(int c = 0 ; c < preparedString2.length();c++)
          if(Character.isAlphabetic(preparedString2.charAt(c)))
          {   
             String encodedString = encodedString+shiftChar(preparedString2.charAt(c),shift); 
          }
          return encodedString; 
       }

  2. #2
    SmokeyWoody is offline Member
    Join Date
    Oct 2014
    Posts
    36
    Rep Power
    0

    Default Re: Help with setting a String using if

    Oh my lord, I fixed it. I need sleep please ignore this post...

Similar Threads

  1. Setting x and y for String
    By NitroDev in forum New To Java
    Replies: 38
    Last Post: 02-17-2014, 10:44 PM
  2. Replies: 1
    Last Post: 06-29-2011, 06:46 PM
  3. Setting up a String Array
    By AJArmstron@aol.com in forum New To Java
    Replies: 12
    Last Post: 04-16-2010, 01:42 PM
  4. Setting the DSN
    By tim in forum JDBC
    Replies: 1
    Last Post: 02-14-2008, 10:55 PM
  5. Help with setting up please
    By BlitzA in forum New To Java
    Replies: 6
    Last Post: 12-29-2007, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •