5 people like it.

Test string is all uppercase

This checks if a string contains all uppercase characters.

1: 
2: 
3: 
4: 
5: 
6: 
open System
open System.Text.RegularExpressions

let isUppercase (input:string):bool =
     Regex.Match(input, "[A-Z]").Success
     && not(Regex.Match(input, "[a-z]").Success)
namespace System
namespace System.Text
namespace System.Text.RegularExpressions
val isUppercase : input:string -> bool

Full name: Script.isUppercase
val input : string
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
type bool = Boolean

Full name: Microsoft.FSharp.Core.bool
Multiple items
type Regex =
  new : pattern:string -> Regex + 1 overload
  member GetGroupNames : unit -> string[]
  member GetGroupNumbers : unit -> int[]
  member GroupNameFromNumber : i:int -> string
  member GroupNumberFromName : name:string -> int
  member IsMatch : input:string -> bool + 1 overload
  member Match : input:string -> Match + 2 overloads
  member Matches : input:string -> MatchCollection + 1 overload
  member Options : RegexOptions
  member Replace : input:string * replacement:string -> string + 5 overloads
  ...

Full name: System.Text.RegularExpressions.Regex

--------------------
Regex(pattern: string) : unit
Regex(pattern: string, options: RegexOptions) : unit
Regex.Match(input: string, pattern: string) : Match
Regex.Match(input: string, pattern: string, options: RegexOptions) : Match
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
Raw view Test code New version

More information

Link:http://fssnip.net/7UC
Posted:6 years ago
Author:LuisFX
Tags: regex , regular expression , regular expressions , string , string manipulation , string matching , string regex