C# Class YAXLib.StringUtils

Provides string utility methods
Mostra file Open project: sinairv/YAXLib

Public Methods

Method Description
CombineLocationAndElementName ( string location, System.Xml.Linq.XName elemName ) : string

Combines a location string and an element name to form a bigger location string.

DivideLocationOneStep ( string location, string &newLocation, string &newElem ) : bool

Divides the location string one step, to form a shorter location string.

ExttractPathAndAliasFromLocationString ( string locationString, string &path, string &alias ) : void

Extracts the path and alias from location string. A pure path location string: level1/level2 A location string augmented with alias: level1/level2#somename Here path is "level1/level2" and alias is "somename".

GetArrayDimsString ( int dims ) : string

Gets the string corresponidng to the given array dimensions.

IsLocationAllGeneric ( string location ) : bool

Determines whether the specified location is composed of levels which are themselves either "." or "..".

IsSingleLocationGeneric ( string location ) : bool

Determines whether the specified location string is either "." or "..".

LooksLikeExpandedXName ( string name ) : bool

Heuristically determines if the supplied name conforms to the "expanded XML name" form supported by the System.Xml.Linq.XName class.

ParseArrayDimsString ( string str ) : int[]

Parses the array dimensions string, and returns the corresponding dimensions array.

ParseDateTimeTimeZoneSafe ( string str, IFormatProvider formatProvider ) : System.DateTime
RefineLocationString ( string elemAddr ) : string

Refines the location string. Trims it, and replaces invlalid characters with underscore.

RefineSingleElement ( string elemName ) : string

Refines a single element name. Refines the location string. Trims it, and replaces invlalid characters with underscore.

SplitPathNamespaceSafe ( this value ) : IEnumerable

Splits a string at each instance of a '/' except where such slashes are within {}.

Private Methods

Method Description
IsInRange ( char ch, char lower, char upper ) : bool
IsValidNameChar ( char ch ) : bool
IsValidNameStartChar ( char ch ) : bool

Method Details

CombineLocationAndElementName() public static method

Combines a location string and an element name to form a bigger location string.
public static CombineLocationAndElementName ( string location, System.Xml.Linq.XName elemName ) : string
location string The location string.
elemName System.Xml.Linq.XName Name of the element.
return string

DivideLocationOneStep() public static method

Divides the location string one step, to form a shorter location string.
public static DivideLocationOneStep ( string location, string &newLocation, string &newElem ) : bool
location string The location string to divide.
newLocation string The new location string which is one level shorter.
newElem string The element name removed from the end of location string.
return bool

ExttractPathAndAliasFromLocationString() public static method

Extracts the path and alias from location string. A pure path location string: level1/level2 A location string augmented with alias: level1/level2#somename Here path is "level1/level2" and alias is "somename".
public static ExttractPathAndAliasFromLocationString ( string locationString, string &path, string &alias ) : void
locationString string The location string.
path string The path to be extracted.
alias string The alias to be extracted.
return void

GetArrayDimsString() public static method

Gets the string corresponidng to the given array dimensions.
public static GetArrayDimsString ( int dims ) : string
dims int The array dimensions.
return string

IsLocationAllGeneric() public static method

Determines whether the specified location is composed of levels which are themselves either "." or "..".
public static IsLocationAllGeneric ( string location ) : bool
location string The location string to check.
return bool

IsSingleLocationGeneric() public static method

Determines whether the specified location string is either "." or "..".
public static IsSingleLocationGeneric ( string location ) : bool
location string The location string to check.
return bool

LooksLikeExpandedXName() public static method

Heuristically determines if the supplied name conforms to the "expanded XML name" form supported by the System.Xml.Linq.XName class.
public static LooksLikeExpandedXName ( string name ) : bool
name string The name to be examined.
return bool

ParseArrayDimsString() public static method

Parses the array dimensions string, and returns the corresponding dimensions array.
public static ParseArrayDimsString ( string str ) : int[]
str string The string to parse.
return int[]

ParseDateTimeTimeZoneSafe() public static method

public static ParseDateTimeTimeZoneSafe ( string str, IFormatProvider formatProvider ) : System.DateTime
str string
formatProvider IFormatProvider
return System.DateTime

RefineLocationString() public static method

Refines the location string. Trims it, and replaces invlalid characters with underscore.
public static RefineLocationString ( string elemAddr ) : string
elemAddr string The element address to refine.
return string

RefineSingleElement() public static method

Refines a single element name. Refines the location string. Trims it, and replaces invlalid characters with underscore.
public static RefineSingleElement ( string elemName ) : string
elemName string Name of the element.
return string

SplitPathNamespaceSafe() public static method

Splits a string at each instance of a '/' except where such slashes are within {}.
public static SplitPathNamespaceSafe ( this value ) : IEnumerable
value this The string to split
return IEnumerable