String Utility - mdzzohrabi/azera-core GitHub Wiki

String utility

Camelize

String::camelize( "active_record" ); 	# => ActiveRecord
String::camelize( "SSLSecure" );		# => SslSecure

Capitalize

String::capitalize( "active" ); 		# => Active

Underscore

String::underscore( "HelloWorld" ); 	# => hello_world

Humanize

String::humanize( "_id" ); 			# => Id
String::humanize( "author_id" ); 	# => Author
String::humanize( "hello_world" ); 	# => Hello world

Pluralize

String::pluralize( "House" ); 	# => Houses
String::pluralize( "Post" );	# => Posts
String::pluralize( "Ruby" );	# => Rubies
String::pluralize( "Person" ); 	# => People
String::plualize( "Category" );	# => Categories

Tableize

String::tableize( "RawScaledScorer" );	# => raw_scaled_scorers
String::tableize( "egg_and_hamm" ); 	# => egg_and_hams
String::tableize( 'fancyCategory' );	# => fancy_categories

Dasherize

String::dasherize( 'users_blog' );	# => users-blog

Titleize

String::titleize( "x-men: the last stand" );	# => X Men: The Last Stand
String::titleize( "man from the boondocks" );	# => Man From The Boondocks

ForeignKey

String::foreign_key( "Post" ); 	# => post_id