module Bindgen::Util::Prefix
Overview
String prefix utilities
Defined in:
bindgen/util/prefix.crClass Method Summary
-
.common(strings : Enumerable(String)) : Int32
Finds the common prefix length of strings, if any.
Class Method Detail
def self.common(strings : Enumerable(String)) : Int32
#
Finds the common prefix length of strings, if any. Returns 0
if the
list is empty, or has only one element. The returned prefix is always
at least one character shorter than the shortest string: Given
[ "Foo", "FooBar" ]
, the returned prefix length is 2
(Fo
).