racket/collects/honu/examples/String.honu
2005-05-27 18:56:37 +00:00

37 lines
833 B
Plaintext

type String {
str value;
void printStr();
void printLine();
Integer strToInt();
Float strToFloat();
Integer strLen();
String substr(int, int);
Character charAt(int);
}
class StrBox() : String impl String {
init str value;
void printStr() { printStr(value); }
void printLine() { printLine(value); }
Integer strToInt() { return new IntBox(value = strToInt(value)); }
Float strToFloat() { return new FloatBox(value = strToFloat(value)); }
Integer strLen() { return new IntBox(value = strLen(value)); }
String substr(int start, int end) {
return new StrBox(value = substr(value, start, end));
}
Character charAt(int i) {
return new CharBox(value = charAt(value, i));
}
export String : value, printStr, printLine, strToInt, strToFloat, strLen,
substr, charAt;
}