String representation of self in the given base

assert 15.to_base(10) == "15"
assert 15.to_base(16) == "f"
assert 15.to_base(2) == "1111"
assert (-10).to_base(3) == "-101"

Property definitions

core :: abstract_text $ Int :: to_base
	# String representation of `self` in the given `base`
	#
	# ~~~
	# assert 15.to_base(10) == "15"
	# assert 15.to_base(16) == "f"
	# assert 15.to_base(2) == "1111"
	# assert (-10).to_base(3) == "-101"
	# ~~~
	fun to_base(base: Int): String
	do
		var l = digit_count(base)
		var s = new Buffer
		s.enlarge(l)
		for x in [0..l[ do s.add(' ')
		fill_buffer(s, base)
		return s.to_s
	end
lib/core/text/abstract_text.nit:1998,2--2014,4