Skip to content

Commit d11374f

Browse files
committed
Added StringHelper::underscores() method
1 parent e5582ab commit d11374f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/Helpers/StringHelper.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,17 @@ public static function is_json( $json ) {
7474

7575
}
7676

77+
/**
78+
* Converts hyphens to underscores in a string
79+
*
80+
* @param string $str Input string
81+
* @return string
82+
* @since 0.2.0
83+
*/
84+
public static function underscores( $str ) {
85+
86+
return str_replace( '-', '_', $str );
87+
88+
}
89+
7790
}

0 commit comments

Comments
 (0)