Skip to content

Commit aae3ef7

Browse files
authored
Create stringvalidator.md
1 parent 12b311a commit aae3ef7

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# StringValidator Class
2+
3+
**A static class containing string validation methods.**
4+
5+
## Class Members
6+
7+
```csharp
8+
IsDate(this string input)
9+
```
10+
11+
Determines whether the specified string is a valid date.
12+
13+
### Parameters
14+
15+
- `input`: The input string.
16+
17+
### Returns
18+
19+
- Type: `bool`
20+
- Description: `true` if the specified string is a valid date; otherwise, `false`.
21+
22+
### Example
23+
24+
```csharp
25+
string dateString = "2022-01-01";
26+
bool isValidDate = dateString.IsDate(); // Returns true
27+
```
28+
29+
---
30+
31+
```csharp
32+
IsDateTime(this string input)
33+
```
34+
35+
Determines whether the specified string is a valid date and time.
36+
37+
### Parameters
38+
39+
- `input`: The input string.
40+
41+
### Returns
42+
43+
- Type: `bool`
44+
- Description: `true` if the specified string is a valid date and time; otherwise, `false`.
45+
46+
### Example
47+
48+
```csharp
49+
string dateTimeString = "2022-01-01 12:00:00";
50+
bool isValidDateTime = dateTimeString.IsDateTime(); // Returns true
51+
```
52+
53+
---
54+
55+
```csharp
56+
IsUnicode(this string input)
57+
```
58+
59+
Determines whether the specified string contains Unicode characters.
60+
61+
### Parameters
62+
63+
- `input`: The input string.
64+
65+
### Returns
66+
67+
- Type: `bool`
68+
- Description: `true` if the specified string contains Unicode characters; otherwise, `false`.
69+
70+
### Example
71+
72+
```csharp
73+
string unicodeString = "こんにちは";
74+
bool isUnicode = unicodeString.IsUnicode(); // Returns true
75+
```
76+
77+
### Remarks
78+
79+
The `StringValidator` class also contains several other methods for string validation, such as `IsEmail`, `IsUrl`, `IsPhoneNumber`, and `IsPostalCode`. These methods provide additional ways to validate string values. For more information and examples of how to use these methods, please refer to the API reference documentation.

0 commit comments

Comments
 (0)