Class StringUtil
Summary description for StringUtil.
Inheritance
Namespace: ImageVault.Common.Lib
Assembly: ImageVault.Common.dll
Syntax
public static class StringUtil : Object
Remarks
2011-10-06 dan: Created
Methods
FilterCharactersFromString(String, String)
Parses the given string and removes all characters that are present in the characters string
Declaration
public static string FilterCharactersFromString(string name, string characters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to parse |
| System.String | characters | The characters to remove |
Returns
| Type | Description |
|---|---|
| System.String | The filtered string |
FilterCharactersFromString(String, String, Boolean)
Parses the given string and filters it according to the parameter settings
Declaration
public static string FilterCharactersFromString(string name, string characters, bool remove)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name to parse |
| System.String | characters | The character filter |
| System.Boolean | remove | If true, all characters found in the characters string will be removed, all others will be kept. If false all characters found in the characters string will be kept, all others will be removed. |
Returns
| Type | Description |
|---|---|
| System.String | The filtered string |
FindText(String, String, String, Boolean, out String)
Finds the the text between the two delimiters.
Declaration
public static string FindText(string source, string startDelimiter, string endDelimiter, bool startAfterNewline, out string foundText)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | source | The source text to search in |
| System.String | startDelimiter | the string that marks the start delimiter |
| System.String | endDelimiter | the string that marks the end delimiter |
| System.Boolean | startAfterNewline | If true, the delimiters are ended with a linefeed. text is parsed after that. |
| System.String | foundText | The text that was found between the delimiters or an empty string if no text or delimiters where found |
Returns
| Type | Description |
|---|---|
| System.String | The source text without found text and delimiters |
FixNewLine(String)
Analyzes the input string and checks for any NewLine markers and converts the present NewLine markers with the one in Environment.NewLine
Declaration
public static string FixNewLine(string data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | The string to fix |
Returns
| Type | Description |
|---|---|
| System.String | The fixed string |
IsBase64(String)
Checks if a supplied string is a base64 encoded string
Declaration
public static bool IsBase64(string s)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | s | The string to check |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the string is a base64 encoded string. False if it's not or null or whitespace |
IsJsonArray(String)
Checks if the supplied text is a json array.
Declaration
public static bool IsJsonArray(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsJsonObject(String)
Checks if the supplied text is a json object
Declaration
public static bool IsJsonObject(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsMacintosh(IEnumerable<Byte>)
Checks for mac specific bytes
Declaration
public static bool IsMacintosh(IEnumerable<byte> bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Byte> | bytes |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it is macintosh, otherwise false. |
IsUtf8(IEnumerable<Byte>)
Checks if the supplied data is valid utf-8 data
Declaration
public static bool IsUtf8(IEnumerable<byte> bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Byte> | bytes | The System.Collections.Generic.IEnumerable<> of System.Byte to check |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it contains only valid utf-8 data |