ExtensionsString Module
Extension methods for System.String. Adds extension members on System.String. E.G. .First, .Second, .Last and similar indices. Also adds functionality for negative indices and s.Slice(startIdx:int , endIdx: int) that works with negative numbers. This module is NOT automatically opened when the namespace Str is opened.
Types
Type | Description |
An Exception for the string functions defined in Str |
Functions and values
Function or value |
Description
|
Full Usage:
exnf s
Parameters:
string
Returns: string
|
For string formatting in exceptions. Including surrounding quotes
|
Type extensions
Type extension |
Description
|
Full Usage:
this.First
Parameters:
unit
Returns: char
Modifiers: inline |
Returns then first character of the string fails if string is empty
Extended Type:
|
Full Usage:
this.First
Returns: char
Modifiers: inline |
Returns then first character of the string fails if string is empty
Extended Type:
|
Full Usage:
this.Get
Parameters:
int
Returns: char
Modifiers: inline |
Gets an character at index, same as this.[index] or this.Idx(index) Throws a descriptive Exception if the index is out of range. (Use this.GetNeg(i) member if you want to use negative indices too)
Extended Type:
|
Full Usage:
this.GetLooped
Parameters:
int
Returns: char
|
Any index will return a value. Rarr is treated as an endless loop in positive and negative direction
Extended Type:
|
Full Usage:
this.GetNeg
Parameters:
int
Returns: char
|
Gets an item in the string by index. Allows for negative index too ( -1 is last item, like Python) (from the release of F# 5 on a negative index can also be done with '^' prefix. E.g. ^0 for the last item)
Extended Type:
|
Full Usage:
this.Idx
Parameters:
int
Returns: char
Modifiers: inline |
Gets an character at index, same as this.[index] or this.Get(index) Throws a descriptive Exception if the index is out of range. (Use this.GetNeg(i) member if you want to use negative indices too)
Extended Type:
|
Full Usage:
this.Last
Parameters:
unit
Returns: char
Modifiers: inline |
Returns the last character of the string fails if string is empty
Extended Type:
|
Full Usage:
this.Last
Returns: char
Modifiers: inline |
Returns the last character of the string fails if string is empty
Extended Type:
|
Full Usage:
this.LastIndex
Parameters:
unit
Returns: int
Modifiers: inline |
Returns the last valid index in the string same as: s.Length - 1
Extended Type:
|
Full Usage:
this.LastIndex
Returns: int
Modifiers: inline |
|
Full Usage:
this.LastX
Parameters:
int
Returns: string
Modifiers: inline |
Returns the last x(int) characters of the string same as string.LastN
Extended Type:
|
|
|
|
|
Full Usage:
this.Second
Parameters:
unit
Returns: char
Modifiers: inline |
Returns the second character of the string fails if string has less than two characters
Extended Type:
|
Full Usage:
this.Second
Returns: char
Modifiers: inline |
Returns the second character of the string fails if string has less than two characters
Extended Type:
|
Full Usage:
this.SecondLast
Parameters:
unit
Returns: char
Modifiers: inline |
Returns the second last character of the string fails if string has less than two characters
Extended Type:
|
Full Usage:
this.SecondLast
Returns: char
Modifiers: inline |
Returns the second last character of the string fails if string has less than two characters
Extended Type:
|
Full Usage:
this.Slice
Parameters:
int
endIdx : int
Returns: string
|
Allows for negative indices too. -1 is last character Includes end index in string for example str.Slice(0,-3) will trim off the last two character from the string
Extended Type:
|
Full Usage:
this.Third
Parameters:
unit
Returns: char
Modifiers: inline |
Returns the third character of the string fails if string has less than three characters
Extended Type:
|
Full Usage:
this.Third
Returns: char
Modifiers: inline |
Returns the third character of the string fails if string has less than three characters
Extended Type:
|
Full Usage:
this.ThirdLast
Parameters:
unit
Returns: char
Modifiers: inline |
Returns the third last character of the string fails if string has less than three characters
Extended Type:
|
Full Usage:
this.ThirdLast
Returns: char
Modifiers: inline |
Returns the third last character of the string fails if string has less than three characters
Extended Type:
|