diff --git a/core/strings/strings.odin b/core/strings/strings.odin index f89438c0a..49f15303b 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -773,7 +773,8 @@ string_case_iterator :: proc(b: ^Builder, s: string, callback: proc(b: ^Builder, to_lower_camel_case :: to_camel_case; to_camel_case :: proc(s: string, allocator := context.allocator) -> string { - s := trim_space(s); + s := s; + s = trim_space(s); b := make_builder(0, len(s), allocator); string_case_iterator(&b, s, proc(b: ^Builder, prev, curr, next: rune) { @@ -793,7 +794,8 @@ to_camel_case :: proc(s: string, allocator := context.allocator) -> string { to_upper_camel_case :: to_pascal_case; to_pascal_case :: proc(s: string, allocator := context.allocator) -> string { - s := trim_space(s); + s := s; + s = trim_space(s); b := make_builder(0, len(s), allocator); string_case_iterator(&b, s, proc(b: ^Builder, prev, curr, next: rune) { @@ -812,7 +814,8 @@ to_pascal_case :: proc(s: string, allocator := context.allocator) -> string { } to_delimiter_case :: proc(s: string, delimiter: rune, all_upper_case: bool, allocator := context.allocator) -> string { - s := trim_space(s); + s := s; + s = trim_space(s); b := make_builder(0, len(s), allocator); adjust_case := unicode.to_upper if all_upper_case else unicode.to_lower; @@ -868,7 +871,8 @@ to_upper_case :: proc(s: string, allocator := context.allocator) -> string { to_ada_case :: proc(s: string, allocator := context.allocator) -> string { delimiter :: '_'; - s := trim_space(s); + s := s; + s = trim_space(s); b := make_builder(0, len(s), allocator); prev, curr: rune;