Class Utilities
Utility class for different static methods.
Inheritance
Inherited Members
Namespace: Syncfusion.HTMLUI.Base.Utility
Assembly: Syncfusion.HTMLUI.Base.dll
Syntax
public sealed class Utilities
Fields
DEF_FRAGMENT_PREFIX
Prefix of the fragment in the Uri object.
Declaration
public const char DEF_FRAGMENT_PREFIX = '#'
Field Value
Type |
---|
System.Char |
DEF_REGEX_OPTIONS
Options for regular expressions.
Declaration
public const RegexOptions DEF_REGEX_OPTIONS
Field Value
Type |
---|
System.Text.RegularExpressions.RegexOptions |
Methods
ArabicToLetter(Int32)
Converts arabic number to "A" format.
Declaration
public static string ArabicToLetter(int arabic)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | arabic | Number in arabic format. |
Returns
Type | Description |
---|---|
System.String | Number in "A" format. |
ArabicToRoman(Int32)
Converts arabic number to roman.
Declaration
public static string ArabicToRoman(int intArabic)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | intArabic | Number in arabic format. |
Returns
Type | Description |
---|---|
System.String | Number in Roman format. |
ConvertToBool(String)
Converts string to its bool representation.
Declaration
public static bool ConvertToBool(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | String representation of the bool. |
Returns
Type | Description |
---|---|
System.Boolean | Bool value. |
ConvertToInteger(String)
Converts ShortVariant value to integer and returns it.
Declaration
public static int ConvertToInteger(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Value to convert. |
Returns
Type | Description |
---|---|
System.Int32 | Integer value. |
ConvertToPoint(String)
Returns point from its string representation.
Declaration
public static Point ConvertToPoint(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | String representation of the point. |
Returns
Type | Description |
---|---|
System.Drawing.Point | Point form of string. |
ConvertToSize(String)
Returns size from its string representation.
Declaration
public static Size ConvertToSize(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | String representation of the size. |
Returns
Type | Description |
---|---|
System.Drawing.Size | Size object. |
ConvertToString(String)
Converts ShortVariant value to string and returns it.
Declaration
public static string ConvertToString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Value to convert. |
Returns
Type | Description |
---|---|
System.String | String interpretation of the variant value. |
DeleteWhiteSpace(String)
Trims big whitespaces from the specified string to single, skip tabs, new lines, etc.
Declaration
public static string DeleteWhiteSpace(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | String value. |
Returns
Type | Description |
---|---|
System.String | String after deleting whitespaces. |
DetectEncoding(String)
Detects and returns the encoding from it's string name.
Declaration
public static Encoding DetectEncoding(string encType)
Parameters
Type | Name | Description |
---|---|---|
System.String | encType | Name of encoding. |
Returns
Type | Description |
---|---|
System.Text.Encoding | Encoding data if detected; Null otherwise. |
ExtractBookmark(String)
Extracts bookmark path from the specified full path and returns array where the first element is the path without bookmark; second - bookmark if found.
Declaration
public static string[] ExtractBookmark(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to resource. |
Returns
Type | Description |
---|---|
System.String[] | Array where first element is path without bookmark; second - bookmark if found. |
GetBookmark(String)
Retrieves bookmark data from path where bookmark data may exist.
Declaration
public static string GetBookmark(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to file. |
Returns
Type | Description |
---|---|
System.String | Bookmark data from path where bookmark data may exist. |
GetConvertedString(String)
Converts string with special HTML symbols to string view.
Declaration
public static string GetConvertedString(string input)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | String with special symbols. |
Returns
Type | Description |
---|---|
System.String | Converted string if symbols exist; input string otherwise. |
GetFullPath(String, String)
Returns the absolute path for the file.
Declaration
public static string GetFullPath(string currentDir, string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Additional directory for searching the file. |
System.String | path | Path to the file. |
Returns
Type | Description |
---|---|
System.String | Full path for the file if file exists; NULL otherwise. |
ImageFromFile(String)
Loads and returns bitmap from the file.
Declaration
public static Bitmap ImageFromFile(string fullPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | fullPath | Full path to the file. |
Returns
Type | Description |
---|---|
System.Drawing.Bitmap | Bitmap if loaded; Null otherwise. |
ImageFromStream(Stream)
Creates bitmap object from the stream.
Declaration
public static Bitmap ImageFromStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Bitmap stream data. |
Returns
Type | Description |
---|---|
System.Drawing.Bitmap | Bitmap object, if bitmap is created; NULL otherwise. |
IsFileExists(String, String)
Indicates whether file with such path exists. Searches in specified directory also.
Declaration
public static bool IsFileExists(string currentDir, string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Additional directory for searching the file. |
System.String | path | Path to the file. |
Returns
Type | Description |
---|---|
System.Boolean | True if file is found. |
IsFileExists(String, String, out String)
Indicates whether file with specified path exists. Searches in additional directory also.
Declaration
public static bool IsFileExists(string currentDir, string path, out string fullPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Additional directory for searching the file. |
System.String | path | Path to the file. |
System.String | fullPath | Full path to the file. |
Returns
Type | Description |
---|---|
System.Boolean | True if file exists; False otherwise. |
IsUriExists(String, String, out Uri)
Indicates whether resource by Uri with defined path exists. Searches in additional Uri base also.
Declaration
public static bool IsUriExists(string currentDir, string path, out Uri fullUriPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Additional root uri for searching resource. |
System.String | path | Path to resource. |
System.Uri | fullUriPath | Uri object to the file. |
Returns
Type | Description |
---|---|
System.Boolean | True if file by Uri exists; False otherwise. |
ReadToEnd(Stream)
Reads data from the specified stream.
Declaration
public static byte[] ReadToEnd(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Source stream for data reading. |
Returns
Type | Description |
---|---|
System.Byte[] | Array of data from the stream. |
RemoveBookmark(String)
Retrieves path to file from path where bookmark data may exist.
Declaration
public static string RemoveBookmark(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to file. |
Returns
Type | Description |
---|---|
System.String | Path to file from path where bookmark data may exist. |
StreamFromFile(String, String)
Creates and returns the stream from the specified file.
Declaration
public static Stream StreamFromFile(string currentDir, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Current directory. |
System.String | fileName | Path to the file. |
Returns
Type | Description |
---|---|
System.IO.Stream | Stream object if resource found; Null otherwise. |
StreamFromString(String)
Converts the given string to memory stream.
Declaration
public static Stream StreamFromString(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | The string to convert in to stream. |
Returns
Type | Description |
---|---|
System.IO.Stream | Stream data from string |
StreamFromUrl(Uri)
Returns data from the specified Uri address.
Declaration
public static Stream StreamFromUrl(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | Uri path to the resource. |
Returns
Type | Description |
---|---|
System.IO.Stream | Data from Uri resource. |
StrEquals(String, String)
Indicates whether two strings are equal or not. Method is case insensitive.
Declaration
public static bool StrEquals(string a, string b)
Parameters
Type | Name | Description |
---|---|---|
System.String | a | First string. |
System.String | b | Second string. |
Returns
Type | Description |
---|---|
System.Boolean | True if strings are equal by value. |
StringFromFile(String, String)
Returns string data extracted from the specified file with default encoding.
Declaration
public static string StringFromFile(string currentDir, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentDir | Name of the Directory. |
System.String | fileName | Name of the file. |
Returns
Type | Description |
---|---|
System.String | String data extracted from the file with default encoding. |
StringFromStream(Stream, Encoding)
Reads data from the specified stream and converts it to the stream.
Declaration
public static string StringFromStream(Stream stream, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream with data. |
System.Text.Encoding | encoding | Encoding object. |
Returns
Type | Description |
---|---|
System.String | String data from the stream. |
StringFromUrl(Uri)
Returns data from the specified Uri address.
Declaration
public static string StringFromUrl(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | Uri path to the resource. |
Returns
Type | Description |
---|---|
System.String | Data from Uri resource. |