String

struct String

Contains generic utility methods for String.

  • Returns a new string in which all occurrences of characters inside a target set are removed from the receiver string.

    Declaration

    Swift

    public func bky_removingOccurrences(ofCharacterSet invalidCharacters: CharacterSet) -> String

    Return Value

    A new string in which all occurrences of characters inside characterSet are removed.

  • Computes the size of the bounding box that would be needed to render the current string, constrained to a maximum width.

    Declaration

    Swift

    public func bky_multiLineSizeWithAttributes(
        _ attributes: [NSAttributedStringKey : Any]?, constrainedToWidth width: CGFloat) -> CGSize

    Return Value

    The size required to render the string.

  • Computes the size of the bounding box that would be needed to render the current string using a given font, constrained to a maximum width.

    Declaration

    Swift

    public func bky_multiLineSize(forFont font: UIFont, constrainedToWidth width: CGFloat) -> CGSize

    Return Value

    The size required to render the string.

  • Computes the size of the bounding box that would be needed to render the current string using a given font, on a single-line.

    Declaration

    Swift

    public func bky_singleLineSize(forFont font: UIFont) -> CGSize

    Return Value

    The size required to render the string.

  • Escapes the current string so it can be used as a JavaScript parameter when calling a JS method using UIWebView/WKWebView’s evaluateJavaScript(...).

    Declaration

    Swift

    public func bky_escapedJavaScriptParameter() -> String

    Return Value

    The escaped JavaScript string.