if module_name != null then file_out.write "module {module_name}\n"
file_out.write("\n")
- file_out.write(imports.join(""))
+ file_out.write(imports.join)
file_out.write("\n")
- file_out.write(class_content.join(""))
- file_out.write(wrappers.join(""))
+ file_out.write(class_content.join)
+ file_out.write(wrappers.join)
end
fun gen_licence: String
temp.add("extern class Native{jtype.id} in \"Java\" `\{ {jtype} `\}\n")
temp.add("\tsuper JavaObject\n\n")
- return temp.join("")
+ return temp.join
end
fun gen_unknown_class_header(jtype: JavaType): String
temp.add("extern class {nit_type} in \"Java\" `\{ {jtype.to_package_name} `\}\n")
temp.add("\tsuper JavaObject\n\nend\n")
- return temp.join("")
+ return temp.join
end
fun gen_attribute(jid: String, jtype: JavaType): String
var temp = new Array[String]
- temp.add(comment + nit_signature.join(""))
+ temp.add(comment + nit_signature.join)
# FIXME : This huge `if` block is only necessary to copy primitive arrays as long as there's no better way to do it
if comment == "#" then
temp.add(" in \"Java\" `\{\n{comment}\t\tself.{jmethod_id}({java_params});\n{comment}\t`\}\n")
end
- return temp.join("")
+ return temp.join
end
end
var name
if is_primitive_array then
# Primitive arrays have a special naming convention
- name = "Native" + extern_class_name.join("").capitalized + "Array"
+ name = "Native" + extern_class_name.join.capitalized + "Array"
else
- name = "Native" + extern_class_name.join("")
+ name = "Native" + extern_class_name.join
end
var nit_type = new NitType(name)
var text = self["text"]
if text isa JsonArray then
- return text.join("")
+ return text.join
else
return "UNDEFINED"
end
do
var code_lines = new Array[String]
for line in lines do code_lines.add(line.text)
- var code = code_lines.join("")
+ var code = code_lines.join
code = code.replace("\n","\\l").replace("\"","\\\"").replace("\\n","|n").replace("/","\\/").replace("\r","")
# the last one is a hack
for i in [0..10[ do
var a = (['[', ']'] * n)
a.shuffle
- var b = a.join("")
+ var b = a.join
if is_balanced(b) then print "{b} is well-balanced" else print "{b} is not well-balanced"
end
var ary = "_###_##_#_#_#_#__#__".chars
loop
- print ary.join("")
+ print ary.join
var nxt = evolve(ary)
if ary == nxt then break
ary = nxt
class XMLDocument
super XMLEntity
- redef fun to_s do return children.join("")
+ redef fun to_s do return children.join
end
# PCDATA is any kind of non-xml formatted text
else format.add "V"
end
- return format.join("")
+ return format.join
end
# Similar to `build_c_signature` but adapted to create the signature expected by JNI for C functions
# Fiveth way: Join arrays.
# Pro: Sometime efficient on complex concatenation.
# Con: Crazy.
-printn(["The value of a is: ", a.to_s, ".\n"].join(""))
+printn(["The value of a is: ", a.to_s, ".\n"].join)