[−][src]Function inflector::cases::snakecase::to_snake_case
pub fn to_snake_case(non_snake_case_string: &str) -> String
Converts a &str
to snake_case
String
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "foo_bar"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "HTTP Foo bar"; let expected_string: String = "http_foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "HTTPFooBar"; let expected_string: String = "http_foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "Foo bar"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "Foo Bar"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "FooBar"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "FOO_BAR"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "fooBar"; let expected_string: String = "foo_bar".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);
use inflector::cases::snakecase::to_snake_case; let mock_string: &str = "fooBar3"; let expected_string: String = "foo_bar_3".to_string(); let asserted_string: String = to_snake_case(mock_string); assert!(asserted_string == expected_string);