Skip to main content
deleted 775 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

Java 78, 166 66 63 52 4343 21 bytes

int c(String s){return s->s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Try it online.

Explanation:

ints-> c(String s){         // Method with String parameter and integer return-type
  return s.trim()    //  Remove leading and trailing whitspaceswhitespaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

Java 8, 166 66 63 52 43 21 bytes

s->s.trim().charAt(1)

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Try it online.

Explanation:

s->           // Method with String parameter and integer return-type
  s.trim()    //  Remove leading and trailing whitespaces
   .charAt(1) //  and return the second character (as int value)
Commonmark migration
Source Link

#Java 7, 166 66 63 52 43 bytes

Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

#Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer@Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

#Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32

#Java 7, 166 66 63 52 43 bytes

int c(String s){return s.trim().charAt(1);}

Outputs 35 for right and 32 for left.
Based on @Clashsoft's Dyvil answer.

Explanation:

int c(String s){   // Method with String parameter and integer return-type
  return s.trim()  //  Remove leading and trailing whitspaces
   .charAt(1);     //  and return the second character (as int value)
}                  // End of method

Test code:

class M{
  static int c(String s){return s.trim().charAt(1);}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

35
35
35
35
32
32
deleted 181 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
deleted 1 character in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
deleted 61 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 1714 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading