diff --git a/cmd/tools/vdoc/main.v b/cmd/tools/vdoc/main.v index ef7a46a61d..8dacf3070d 100644 --- a/cmd/tools/vdoc/main.v +++ b/cmd/tools/vdoc/main.v @@ -70,7 +70,6 @@ fn main() { vd.vprintln('Setting output type to "${cfg.output_type}"') vd.generate_docs_from_file() if cfg.run_examples != .skip { - println('') if vd.example_oks == 0 && vd.example_failures == 0 { println(term.colorize(term.bright_yellow, 'Found NO examples.')) } else { diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index c9cf163366..e4a7880d5f 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -430,7 +430,7 @@ pub fn (mut a array) reset() { // trim trims the array length to `index` without modifying the allocated data. // If `index` is greater than `len` nothing will be changed. -// Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 10 +// Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 3 pub fn (mut a array) trim(index int) { if index < a.len { a.len = index @@ -819,7 +819,7 @@ pub fn (a &array) free() { // Each function takes a boolean test expression as its single argument. // These test expressions may use `it` as a pointer to a single element at a time. // -// Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3,5] // create an array of elements less than 5 +// Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3] // create an array of elements less than 5 // Example: a := [10,20,30,3,5,99]; assert a.filter(it % 2 == 1) == [3,5,99] // create an array of only odd elements // Example: struct Named { name string }; a := [Named{'Abc'}, Named{'Bcd'}, Named{'Az'}]; assert a.filter(it.name[0] == `A`).len == 2 pub fn (a array) filter(predicate fn (voidptr) bool) array @@ -878,7 +878,7 @@ pub fn (a array) map(callback fn (voidptr) voidptr) array // // Example: mut aa := [5,2,1,10]; aa.sort(); assert aa == [1,2,5,10] // will sort the array in ascending order // Example: mut aa := [5,2,1,10]; aa.sort(b < a); assert aa == [10,5,2,1] // will sort the array in descending order -// Example: struct Named { name string }; mut aa := [Named{'Abc'}, Named{'Xyz'}]; aa.sort(b.name < a.name); assert aa.map(it.name) == ['Abc', 'Xyz'] // will sort descending by the .name field +// Example: struct Named { name string }; mut aa := [Named{'Abc'}, Named{'Xyz'}]; aa.sort(b.name < a.name); assert aa.map(it.name) == ['Xyz','Abc'] // will sort descending by the .name field pub fn (mut a array) sort(callback fn (voidptr, voidptr) int) // sorted returns a sorted copy of the original array. The original array is *NOT* modified. diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 3f9cad4806..53f9c87f08 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -2846,7 +2846,7 @@ pub fn (s string) is_identifier() bool { // camel_to_snake convert string from camelCase to snake_case // Example: assert 'Abcd'.camel_to_snake() == 'abcd' // Example: assert 'aaBB'.camel_to_snake() == 'aa_bb' -// Example: assert 'BBaa'.camel_to_snake() == 'b_baa' +// Example: assert 'BBaa'.camel_to_snake() == 'bb_aa' // Example: assert 'aa_BB'.camel_to_snake() == 'aa_bb' @[direct_array_access] pub fn (s string) camel_to_snake() string {