ToLowerCase
Zur Navigation springen
Zur Suche springen
Beschreibung
Die Funktion toLowerCase wandelt alle Buchstaben von a-z, A-Z einer Zeichenkette in Kleinbuchstaben um. Die Funktion erwartet einen String und gibt einen String zurück.
Syntax
toLowerCase(String zeichenkette)
Parameter
- zeichenkette - die Zeichenkette, in der alle Buchstaben in Großbuchstaben umgewandelt werden sollen
Return Value
- Gibt einen String zurück
Beispiele
Standardfälle
toLowerCase('ICH BIN GROSS') --> returns 'ich bin gross' toLowerCase('ABCDEFGHIJKLMNOPQRSTUVWXYZ') --> returns 'abcdefghijklmnopqrstuvwxyz' toLowerCase('1234567890.!\"§$%&/()=?') --> returns '1234567890.!\"§$%&/()=?'
Benutzung mit Variablen
toLowerCase('[pos=1]') toLowerCase('[var=a]')
JUnit Tests
[Anzeigen]
private static double PI = Math.PI;
@BeforeClass
public static void beforeTest() {
OMOBJ to180 = new OMOBJ();
OMOBJ zero = new OMOBJ();
to180.setOMI(OMCreator.createOMI(180));
zero.setOMI(OMCreator.createOMI(0));
fillIn.put(1, to180);
fillIn.put(2, zero);
exerVar.put("a", to180);
exerVar.put("b", zero);
}
@Test
public void testToRadians1() {
assertEquals(PI, Evaluator.getNumberResult("toRadians(180)", exerVar, fillIn), 0);
}
@Test
public void testToRadians2() {
assertEquals(2 * PI, Evaluator.getNumberResult("toRadians(360)", exerVar, fillIn), 0);
}
@Test
public void testToRadians3() {
assertEquals(3 * PI, Evaluator.getNumberResult("toRadians(540)", exerVar, fillIn), 0);
}
@Test
public void testToRadians4() {
assertEquals(PI / 2, Evaluator.getNumberResult("toRadians(90)", exerVar, fillIn), 0);
}
@Test
public void testToRadians5() {
assertEquals(-PI, Evaluator.getNumberResult("toRadians(-180)", exerVar, fillIn), 0);
}
@Test
public void testToRadians6() {
assertEquals(0, Evaluator.getNumberResult("toRadians(0)", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithInput1() {
assertEquals(PI, Evaluator.getNumberResult("toRadians('[pos=1]')", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithInput2() {
assertEquals(0, Evaluator.getNumberResult("toRadians('[pos=2]')", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithVariables1() {
assertEquals(PI, Evaluator.getNumberResult("toRadians('[var=a]')", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithVariables2() {
assertEquals(0, Evaluator.getNumberResult("toRadians('[var=b]')", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithPointNumbers1() {
assertEquals((PI * .2) / 180, Evaluator.getNumberResult("toRadians(0.2)", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithPointNumbers2() {
assertEquals((-PI * .1) / 180, Evaluator.getNumberResult("toRadians(-0.1)", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithExpressions1() {
assertEquals(0, Evaluator.getNumberResult("toRadians(toRadians(0))", exerVar, fillIn), 0);
}
@Test
public void testToRadiansWithExpressions2() {
assertEquals(0, Evaluator.getNumberResult("toRadians(toRadians(toRadians(0)))", exerVar, fillIn), 0);
}
@Test(expected = FunctionInvalidArgumentTypeException.class)
public void testToRadiansWithWrongInputCharacter() {
Evaluator.getNumberResult("toRadians(a)", exerVar, fillIn);
}
@Test(expected = FunctionInvalidNumberOfArgumentsException.class)
public void testToRadiansWithTwoArguments() {
Evaluator.getNumberResult("toRadians(180, 90)", exerVar, fillIn);
}
@Test(expected = FunctionInvalidNumberOfArgumentsException.class)
public void testToRadiansWithThreeArguments() {
Evaluator.getNumberResult("toRadians(45, 90, 180)", exerVar, fillIn);
}
@Test(expected = UndefinedExerciseVariableException.class)
public void testToRadiansWithMissingExerciseVariable() {
Evaluator.getNumberResult("toRadians('[var=j]')", exerVar, fillIn);
}
@Test(expected = UndefinedFillInVariableException.class)
public void testToRadiansWithMissingInput() {
Evaluator.getNumberResult("toRadians('[pos=42]')", exerVar, fillIn);
}