MCPcopy Index your code
hub / github.com/apache/groovy / normaliseStringType

Method normaliseStringType

src/main/java/groovy/lang/ObjectRange.java:578–590  ·  view source on GitHub ↗

if operand is a Character or a String with one character, return that character's int value.

(final Comparable operand)

Source from the content-addressed store, hash-verified

576 * if operand is a Character or a String with one character, return that character's int value.
577 */
578 private static Comparable normaliseStringType(final Comparable operand) {
579 if (operand instanceof Character) {
580 return (int) (Character) operand;
581 }
582 if (operand instanceof String string) {
583
584 if (string.length() == 1) {
585 return (int) string.charAt(0);
586 }
587 return string;
588 }
589 return operand;
590 }
591}

Callers 1

ObjectRangeMethod · 0.95

Calls 2

lengthMethod · 0.45
charAtMethod · 0.45

Tested by

no test coverage detected