NameUtils
Namespace: FSharp.Data.Runtime
Tools for generating nice member names that follow F# & .NET naming conventions
Functions and values
Function or value | Description |
capitalizeFirstLetter(s)
Signature: s:string -> string
|
|
niceCamelName(s)
Signature: s:string -> string
|
Turns a given non-empty string into a nice 'camelCase' identifier
|
nicePascalName(s)
Signature: s:string -> string
|
Turns a given non-empty string into a nice 'PascalCase' identifier
|
pluralize(s)
Signature: s:string -> string
|
Return the plural of an English word
|
singularize(s)
Signature: s:string -> string
|
Return the singular of an English word
|
trimHtml(s)
Signature: s:string -> string
|
Trim HTML tags from a given string and replace all of them with spaces
Multiple tags are replaced with just a single space. (This is a recursive
implementation that is somewhat faster than regular expression.)
|
uniqueGenerator(niceName)
Signature: niceName:(string -> string) -> string -> string
|
Given a function to format names (such as niceCamelName or nicePascalName )
returns a name generator that never returns duplicate name (by appending an
index to already used names)
This function is curried and should be used with partial function application:
1:
2:
3:
|
let makeUnique = uniqueGenerator nicePascalName
let n1 = makeUnique "sample-name"
let n2 = makeUnique "sample-name"
|
val makeUnique : (string -> obj)
val n1 : obj
val n2 : obj
|