racket/collects/honu/examples/old/String.honu
Stevie Strickland 7dbb99d3c6 merged 292:296 from branches/sstrickl
svn: r297
2005-07-02 04:03:02 +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;
}