toSnakeCase

string
toSnakeCase
@property pure @trusted
(
in string str
,
bool ignore_first = true
)

Examples

1 assertEq( "SomeVar".toSnakeCase, "some_var" );
2 assertEq( "SomeVar".toSnakeCase(false), "_some_var" );
3 
4 assertEq( "someVar".toSnakeCase, "some_var" );
5 assertEq( "someVar".toSnakeCase(false), "some_var" );
6 
7 assertEq( "ARB".toSnakeCase, "a_r_b" );
8 assertEq( "ARB".toSnakeCase(false), "_a_r_b" );
9 
10 // not alphabetic chars in upper case looks like lower, func separate by them
11 assertEq( "A.B.r.A".toSnakeCase, "a_._b_.r_._a" );
12 assertEq( "A_B_r_A".toSnakeCase, "a___b__r___a" );

Meta