StringUtils.swift 675 B

123456789101112131415161718192021
  1. // Sources/SwiftProtobufPluginLibrary/StringUtils.swift - String processing utilities
  2. //
  3. // Copyright (c) 2014 - 2016 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. import Foundation
  11. @inlinable
  12. func trimWhitespace(_ s: String) -> String {
  13. s.trimmingCharacters(in: .whitespacesAndNewlines)
  14. }
  15. @inlinable
  16. func trimWhitespace(_ s: String.SubSequence) -> String {
  17. s.trimmingCharacters(in: .whitespacesAndNewlines)
  18. }