Skip to content

Instantly share code, notes, and snippets.

@dburriss
Created November 2, 2022 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dburriss/0d154eed880ec234904be6192d2e8d44 to your computer and use it in GitHub Desktop.
Save dburriss/0d154eed880ec234904be6192d2e8d44 to your computer and use it in GitHub Desktop.
Collection of F# string functions
let isNotEmpty s = not (String.IsNullOrEmpty s)
let join (ss: string seq) = String.Join("", ss)
let lower (s: string) = s.ToLowerInvariant()
let trim (s: string) = s.Trim()
let replace (oldValue: string) newValue (s: string) = s.Replace(oldValue,newValue)
let split (by: string) (s: string) = s.Split(by)
let endsWith (tail: string) (s: string) = s.EndsWith(tail)
let startsWith (head: string) (s: string) = s.StartsWith(head)
let contains (search: string) (s: string) = s.Contains(search)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment