FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NetCoreServer/source/NetCoreServer/StringExtensions.cs at master · stratdev3/NetCoreServer · GitHub
stratdev3
NetCoreServer
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NetCoreServer
/
source
/
NetCoreServer
/
StringExtensions.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (14 loc) · 747 Bytes
Breadcrumbs
NetCoreServer
/
source
/
NetCoreServer
/
StringExtensions.cs
Copy path
File metadata and controls
15 lines (14 loc) · 747 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using
System
;
using
System
.
Linq
;
namespace
NetCoreServer
{
/// <summary>
/// String extensions utility class.
/// </summary>
public
static
class
StringExtensions
{
public
static
string
RemoveSuffix
(
this
string
self
,
char
toRemove
)
=>
string
.
IsNullOrEmpty
(
self
)
?
self
:
(
self
.
EndsWith
(
toRemove
)
?
self
.
Substring
(
0
,
self
.
Length
-
1
)
:
self
)
;
public
static
string
RemoveSuffix
(
this
string
self
,
string
toRemove
)
=>
string
.
IsNullOrEmpty
(
self
)
?
self
:
(
self
.
EndsWith
(
toRemove
)
?
self
.
Substring
(
0
,
self
.
Length
-
toRemove
.
Length
)
:
self
)
;
public
static
string
RemoveWhiteSpace
(
this
string
self
)
=>
string
.
IsNullOrEmpty
(
self
)
?
self
:
new
string
(
self
.
Where
(
c
=>
!
Char
.
IsWhiteSpace
(
c
)
)
.
ToArray
(
)
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL