title: Loop Through a String and return just one character in Java
body: <p>so I'm developing this Java program which I need to iterate through a string of character and I just want to return back a character in which it contains (F or f or S or s or B or b or or L or l) in which if there is duplicate of the character found in the string it just take take ealiest character found. I'm just a beginner so please help me. this is what I can have so far. Thanks for your time</p>
  
  <p>command ="France";  </p>
  
  <pre><code>public static char CommandRestrictor (String command)   
  {
  
      for(int i=0; i&lt;command.length();i++)
      {
          char result=command.charAt(i); //set variable character char_bin to binary value in place of i
  
          if(result=='F'||result=='f'||result=='L'||result=='l'||result=='S'||result=='s'||result=='B'||result=='b'||result=='r'||result=='R') {
              return ;
          }
          else {
              return 'f';
          }
  
  
  
  
  }
      return result;
  }
  </code></pre>
  
  <p>input result: "France";
  output result: 'F'</p>