Takes a camel case self and converts it to snake case

assert "randomMethodId".to_snake_case == "random_method_id"

The rules are the following:

An uppercase is always converted to a lowercase

assert "HELLO_WORLD".to_snake_case == "hello_world"

An uppercase that follows a lowercase is prefixed with an underscore

assert "HelloTheWORLD".to_snake_case == "hello_the_world"

An uppercase that follows an uppercase and is followed by a lowercase, is prefixed with an underscore

assert "HelloTHEWorld".to_snake_case == "hello_the_world"

All other characters are kept as is; self does not need to be a proper CamelCased string.

assert "=-_H3ll0Th3W0rld_-=".to_snake_case == "=-_h3ll0th3w0rld_-="

Property definitions

core $ Text :: to_snake_case
	# Takes a camel case `self` and converts it to snake case
	#
	# ~~~
	# assert "randomMethodId".to_snake_case == "random_method_id"
	# ~~~
	#
	# The rules are the following:
	#
	# An uppercase is always converted to a lowercase
	#
	# ~~~
	# assert "HELLO_WORLD".to_snake_case == "hello_world"
	# ~~~
	#
	# An uppercase that follows a lowercase is prefixed with an underscore
	#
	# ~~~
	# assert "HelloTheWORLD".to_snake_case == "hello_the_world"
	# ~~~
	#
	# An uppercase that follows an uppercase and is followed by a lowercase, is prefixed with an underscore
	#
	# ~~~
	# assert "HelloTHEWorld".to_snake_case == "hello_the_world"
	# ~~~
	#
	# All other characters are kept as is; `self` does not need to be a proper CamelCased string.
	#
	# ~~~
	# assert "=-_H3ll0Th3W0rld_-=".to_snake_case == "=-_h3ll0th3w0rld_-="
	# ~~~
	fun to_snake_case: SELFTYPE is abstract
lib/core/text/abstract_text.nit:1318,2--1349,40

core $ Buffer :: to_snake_case
	redef fun to_snake_case do
		var ret = clone
		ret.snake_case
		return ret
	end
lib/core/text/abstract_text.nit:1789,2--1793,4

core $ String :: to_snake_case
	redef fun to_snake_case do
		if self.is_lower then return self

		var new_str = new Buffer.with_cap(self.length)
		new_str.append self
		new_str.snake_case
		return new_str.to_s
	end
lib/core/text/abstract_text.nit:1508,2--1515,4