Prajna


StringTools

A set of helper routine for string operations

Functions and values

Function or valueDescription
BuildFName dir filename
Signature: dir:string -> filename:string -> string

Similar to Path.Combine, concatenate directory and filename, add \ if necessary.

BuildWebName dir filename
Signature: dir:string -> filename:string -> string

concatenate web URL and subsequent subdirectory, add / if necessary.

ConcatWDelim delim s
Signature: delim:char -> s:string [] -> string

Concatenate string[] to string with deliminator in between. ToDo: use String.concat

HashStringToGuid s
Signature: s:string -> Guid

Hash a string via SHA256 hash, and then use the first 16B of hash to form a GUID

IsNullOrEmpty p
Signature: p:string -> bool

Equivalent to String.IsNullOrEmpty, but our implementation is more efficient for the comparison to null. code in http://referencesource.microsoft.com/#mscorlib/system/string.cs,23a8597f842071f4 is follows. public static bool IsNullOrEmpty(String value) { return (value = null || value.Length == 0); }

ReplaceString (...)
Signature: str:string -> oldValue:string -> newValue:string -> comparison:StringComparison -> string

String.Replace, but take a comparison

UtcNowToString ()
Signature: unit -> string

Current timestamp in standard Prajna format.

VersionFromString s
Signature: s:string -> DateTime

Parse a string of standard datetime format in Prajna

VersionToString d
Signature: d:DateTime -> string

Standard datetime format in Prajna

Fork me on GitHub