comparison core/src/luan/modules/StringLuan.java @ 360:cbb94a7c7a9e

allow mail attachments; add String.to_binary and Binary.to_string;
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 15 Apr 2015 11:32:30 -0600
parents 5e7450ac27f2
children d55e873e1f0d
comparison
equal deleted inserted replaced
359:8848edb0e6bf 360:cbb94a7c7a9e
68 a[i] = (char)chars[i]; 68 a[i] = (char)chars[i];
69 } 69 }
70 return new String(a); 70 return new String(a);
71 } 71 }
72 72
73 @LuanMethod public static byte[] to_binary(String s) {
74 return s.getBytes();
75 }
76
73 public static int len(LuanState luan,String s) throws LuanException { 77 public static int len(LuanState luan,String s) throws LuanException {
74 Utils.checkNotNull(luan,s); 78 Utils.checkNotNull(luan,s);
75 return s.length(); 79 return s.length();
76 } 80 }
77 81