Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/_stdlib_gen/stdlib-content.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ local html = import 'html.libsonnet';
Returns true if the the given string is of zero length.
|||,
},
{
name: 'equalsIgnoreCase',
params: ['str1', 'str2'],
availableSince: 'upcoming',
description: |||
Returns true if the the given <code>str1</code> is equal to <code>str2</code> by doing case insensitive comparison, false otherwise.
|||,
},
{
name: 'asciiUpper',
params: ['str'],
Expand Down
2 changes: 2 additions & 0 deletions stdlib/std.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,8 @@ limitations under the License.
isEmpty(str):: std.length(str) == 0,

contains(arr, elem):: std.any([e == elem for e in arr]),

equalsIgnoreCase(str1, str2):: std.asciiLower(str1) == std.asciiLower(str2),

removeAt(arr, at):: [
arr[i],
Expand Down
3 changes: 3 additions & 0 deletions test_suite/stdlib.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,9 @@ std.assertEqual(std.isEmpty('non-empty string'), false) &&
std.assertEqual(std.contains([1, 2, 3], 2), true) &&
std.assertEqual(std.contains([1, 2, 3], "foo"), false) &&

std.assertEqual(std.equalsIgnoreCase('foo', 'FOO'), true) &&
std.assertEqual(std.equalsIgnoreCase('foo', 'bar'), false) &&

std.assertEqual(std.remove([1, 2, 3], 2), [1, 3]) &&
std.assertEqual(std.removeAt([1, 2, 3], 1), [1, 3]) &&

Expand Down