StringUtil

sangria.util.StringUtil
object StringUtil

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
StringUtil.type

Members list

Value members

Concrete methods

def charHex(ch: Char): String

Computes the lexical distance between strings A and B.

Computes the lexical distance between strings A and B.

The "distance" between two strings is given by counting the minimum number of edits needed to transform string A into string B. An edit can be an insertion, deletion, or substitution of a single character, or a swap of two adjacent characters.

This distance can be useful for detecting typos in input or sorting

Attributes

Returns

distance in number of edits

def orList(items: Seq[String], limit: Int): String
def quotedOrList(items: Seq[String], limit: Int): String

Given [ A, B, C ] return '"A", "B" or "C"'.

Given [ A, B, C ] return '"A", "B" or "C"'.

Attributes

def suggestionList(input: String, options: Seq[String]): Seq[String]

Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.

Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.

Attributes

Deprecated methods

def blockStringValue(rawString: String): String

Produces the value of a block string from its parsed raw value, similar to Coffeescript's block string, Python's docstring trim or Ruby's strip_heredoc.

Produces the value of a block string from its parsed raw value, similar to Coffeescript's block string, Python's docstring trim or Ruby's strip_heredoc.

This implements the GraphQL spec's BlockStringValue() static algorithm.

Attributes

Deprecated
true