|
// retoor <retoor@molodetz.nl>
|
|
|
|
System.print("hello".reverse) // expect: olleh
|
|
System.print("".reverse) // expect:
|
|
System.print("a".reverse) // expect: a
|
|
System.print("abcde".reverse) // expect: edcba
|
|
|
|
System.print("[%("hi".center(10))]") // expect: [ hi ]
|
|
System.print("hi".center(10, "-")) // expect: ----hi----
|
|
System.print("hello".center(3)) // expect: hello
|
|
System.print("x".center(5, ".")) // expect: ..x..
|
|
|
|
System.print("42".lpad(5, "0")) // expect: 00042
|
|
System.print("hello".lpad(3, "x")) // expect: hello
|
|
System.print("a".lpad(5, "-")) // expect: ----a
|
|
|
|
System.print("hi".rpad(5, ".")) // expect: hi...
|
|
System.print("hello".rpad(3, "x")) // expect: hello
|
|
System.print("a".rpad(5, "-")) // expect: a----
|
|
|
|
System.print("42".zfill(5)) // expect: 00042
|
|
System.print("-42".zfill(6)) // expect: -00042
|
|
System.print("+42".zfill(6)) // expect: +00042
|
|
System.print("12345".zfill(3)) // expect: 12345
|
|
|
|
System.print("HelloWorld".removePrefix("Hello")) // expect: World
|
|
System.print("HelloWorld".removePrefix("World")) // expect: HelloWorld
|
|
System.print("".removePrefix("x")) // expect:
|
|
|
|
System.print("HelloWorld".removeSuffix("World")) // expect: Hello
|
|
System.print("HelloWorld".removeSuffix("Hello")) // expect: HelloWorld
|
|
System.print("".removeSuffix("x")) // expect:
|