Angles |
Returns the angles of a uniformly random rotation. |
AsInt |
|
Base64Decode |
Convert from a base64 encoded string |
Base64Encode |
Convert to a base64 encoded string |
BitsSet |
Returns the number of bits set in an integer. This us usually used for flags to count
the amount of flags set. |
CatmullRomSpline |
|
CheckValidationAttributes |
Check all System.ComponentModel.DataAnnotations.ValidationAttributes on this property, and get the error messages if there are any. |
Clamp |
Clamp a number between two values. |
Clone |
|
CollapseSpacesAndPreserveLines |
Collapse sequences of spaces and tabs into a single space, preserving newlines |
CollapseWhiteSpace |
Collapse sequences of whitespace into a single whitespace |
Color |
Returns a random Color |
Columnize |
convert "string" into "string " or " string" |
Contains |
|
Distance |
Return the distance between two strings. Useful for ordering strings by similarity |
Double |
Returns a double between min and max |
FastHash |
Generate FNV-1a hash from given string. |
Float |
Returns a random float between 0 and 1 |
FloatDeterministic |
Get a random float (0-1) from a pre-calculated list. This is faster, and if you put the same seed in, it will always return the same number.
The downside is that it only has 8192 variations of floats, but that seem like enough for most things. |
ForEachTaskAsync |
|
FormatBytes |
Given a number, will format as a memory value, ie 10gb, 4mb |
FormatNumberShort |
"1500" becomes "1,500", "15 000" becomes "15K", "15 000 000" becomes "15KK", etc. |
FormatSeconds |
Formats the given value in format "1w2d3h4m5s". Will not display 0 values. |
FormatSecondsLong |
Formats the given value in format "4 weeks, 3 days, 2 hours and 1 minutes".
Will not display 0 values. Will not display seconds if value is more than 1 hour. |
FormatWithSuffix |
Change 1 to 1st, 2 to 2nd etc |
FromArray |
Returns a random value in an array |
FromBase36 |
Decode the Base36 Encoded string into a number |
FromList |
|
Gaussian |
Sample from a Gaussian distribution with a given mean and standard deviation. |
Gaussian2D |
|
Gaussian3D |
|
Gaussian4D |
|
GetAttributeOfType |
Gets an attribute on an enum field value |
GetCommonBaseType |
|
GetEpoch |
Returns the UNIX time stamp - number of seconds since 1st of January, 1970. |
GetFilenameSafe |
Make the passed in string filename safe. This replaces any invalid characters with "_". |
GetManagedSize |
Get the managed size of a given type. This matches an IL-level sizeof(t), even if it cannot be determined normally in C#.
Note that <c>sizeof(t) != Marshal.SizeOf(t)</c> when t is char or bool. |
GetOrCreate |
|
GetPropertyValue |
Get a property value by name, from a JsonObject. Return defaultValue if it's not found. |
HtmlEncode |
|
Humanize |
Convert date into a human readable relative time string. |
Int |
Returns a random int between min and max (inclusive) |
InvokeWithWarning |
Call an action, swallow any exceptions with a warning |
IsBasedOnGenericType |
Returns if this type is based on a given generic type. |
IsInitOnly |
Determine if this property is init-only. |
IsPowerOfTwo |
Return true if the number is a power of two (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc) |
IsValid |
Returns false if Sandbox.IValid object is null or if Sandbox.IValid.IsValid returns false. |
IsValidTag |
Is this string a valid Tag. This is a way to check if a string is a valid tag, project wide. So our logic is always the same.
- not null
- between 1 and 32 chars
- a-z |
KiloFormat |
Format a large number into "1045M", "56K" |
NormalizeFilename |
Puts a filename into the format /path/filename.ext (from path\FileName.EXT) |
Plural |
Return single if 1 else plural |
QuoteSafe |
Puts quote marks around a string. Internal quotes are backslashed. |
ReadNullTerminatedString |
Read a null terminated string from the stream, at given offset. |
RemoveBadCharacters |
Removes bad, invisible characters that are commonly used to exploit.
https://en.wikipedia.org/wiki/Zero-width_non-joiner |
Rotation |
Returns a uniformly random rotation. |
SimplifyPath |
Gets rid of ../'s (from /path/folder/../file.txt to /path/file.txt) |
SizeFormat |
|
Snippet |
Given a large string, find all occurrences of a substring and return them with padding.
This is useful in situations where you're searching for a word in a hug body of text, and
want to show how it's used without displaying the whole text. |
SplitQuotesStrings |
in : I am "splitting a" string "because it's fun "
out : ["I", "am", "splitting a", "string", "because it's fun"] |
TcbSpline |
|
ToBase36 |
Encode the given number into a Base36 string |
ToBool |
Try to convert to bool. Inputs can be true, false, yes, no, 0, 1, null (caps insensitive) |
ToDateTime |
Converts UNIX time stamp to a DateTime object. |
ToDecimal |
128-bit data type that returns sane results for almost any input.
All other numeric types can cast from this. |
ToDouble |
Convert to System.Double, if not then return <paramref name="Default" />. |
ToDoubleEval |
Convert to System.Double. Might be a string formula. This is always going to be slower than a call to Sandbox.SandboxSystemExtensions.ToDouble(System.String,System.Single). |
ToFloat |
Convert to System.Single, if not then return <paramref name="Default" />. |
ToFloatEval |
Convert to System.Single. Might be a string formula. This is always going to be slower than a call to Sandbox.SandboxSystemExtensions.ToFloat(System.String,System.Single). |
ToInt |
Convert to System.Int32, if not then return <paramref name="Default" />. |
ToIntEval |
Convert to System.Int32. Might be a string formula. This is always going to be slower than a call to Sandbox.SandboxSystemExtensions.ToInt(System.String,System.Int32). |
ToLong |
Convert to System.Int64, if not then return <paramref name="Default" />. |
ToLongEval |
Convert to System.Int64. Might be a string formula. This is always going to be slower than a call to Sandbox.SandboxSystemExtensions.ToLong(System.String,System.Int64). |
ToMetric |
Convert 1100 to 1.1k |
ToRelativeTimeString |
|
ToRemainingTimeString |
|
ToSimpleString |
Returns this type's name, with nicer formatting for generic types. |
ToTitleCase |
Convert a variable name to something more user friendly. |
ToType |
Try to politely convert from a string to another type |
ToUInt |
Convert to System.UInt32, if not then return <paramref name="Default" />. |
ToULong |
Convert to System.UInt64, if not then return <paramref name="Default" />. |
TrimQuoted |
The string might start and end in quotes ( ", ' ), remove those if that is the case. |
Truncate |
If the string is longer than this amount of characters then truncate it
If appendage is defined, it will be appended to the end of truncated strings (ie, "..") |
TruncateFilename |
If the string is longer than this amount of characters then truncate it
If appendage is defined, it will be appended to the end of truncated strings (ie, "..") |
TryToType |
Try to politely convert from a string to another type |
UnsignedMod |
Does what you expected to happen when you did "a % b", that is, handles negative <paramref name="a" /> values by returning a positive number from the end. |
UrlEncode |
|
VectorInCircle |
Uniformly samples a 2D position from all points with distance at most <paramref name="radius" /> from the origin. |
VectorInCube |
Uniformly samples a 3D position from a cube with coordinates in the range -<paramref name="extents" /> to +<paramref name="extents" />. |
VectorInSphere |
Uniformly samples a 3D position from all points with distance at most <paramref name="radius" /> from the origin. |
VectorInSquare |
Uniformly samples a 2D position from a square with coordinates in the range -<paramref name="extents" /> to +<paramref name="extents" />. |
WildcardMatch |
Returns true if this string matches a wildcard match. Check is case insensitive. |
WithExtension |
Adds or replaces the extension of <paramref name="path" /> to <paramref name="ext" />. |
WithFlag |
|