Class TextStream
Allows data manipulation using regular expressions
Inherited Members
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.Core.dll
Syntax
public class TextStream : Base
Constructors
| Improve this Doc View SourceTextStream()
Creates a new connector instance.
Declaration
public TextStream()
Methods
| Improve this Doc View SourceCount(String, String)
Gets how many matches can be found within the given text using a regular expression.
Declaration
public int Count(string content, string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content where the regex will be applied to. |
System.String | regex | The regular expression which will be used to search the content. |
Returns
Type | Description |
---|---|
System.Int32 | The number of matches. |
DirectoryName(String)
Returns the directory name (removes the path and also the filename)
Declaration
public string DirectoryName(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | A path to a file or folder. |
Returns
Type | Description |
---|---|
System.String | A directory name. |
DirectoryPath(String)
Returns the directory path (removes the file name)
Declaration
public string DirectoryPath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | A path to a file |
Returns
Type | Description |
---|---|
System.String | A path to a directory |
Dispose()
Disposes the object releasing its unmanaged properties.
Declaration
public override void Dispose()
Overrides
| Improve this Doc View SourceFileName(String)
Returns the file name (removes the path)
Declaration
public string FileName(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | A path to a file. |
Returns
Type | Description |
---|---|
System.String | A file name. |
Find(String, String)
Gets the matches found within the given text using a regular expression.
Declaration
public string[] Find(string content, string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content where the regex will be applied to. |
System.String | regex | The regular expression which will be used to search the content. |
Returns
Type | Description |
---|---|
System.String[] | A set of matches. |
Replace(String, String, String)
Replaces every match within the given content with the given replacement.
Declaration
public string Replace(string content, string replacement, string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content where the regex will be applied to. |
System.String | replacement | Every match will be replaced with this. |
System.String | regex | The regular expression which will be used to search the content. |
Returns
Type | Description |
---|---|
System.String | The replaced string. |
Substring(String, String)
Gets the substring found within the given text using a regular expression (first match)
Declaration
public string Substring(string content, string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content where the regex will be applied to. |
System.String | regex | The regular expression which will be used to search the content. |
Returns
Type | Description |
---|---|
System.String | A set of matches. |