Skip to content

StringExtension

大魔王有木桑 edited this page Sep 24, 2020 · 2 revisions

字符串方法扩展

  • 命名空间:Nekonya


IsMail

bool IsMail()

判断字符串是否位邮箱地址。

用例:

bool isMail = "yomunsam@nekonya.io".IsMail();

string mail = "yomunsam@nekonya.io";
mail.IsMail();

Reverse

string Reverse()

反转字符串

用例:

string str1 = "abc123";
string str2 = str1.Reverse(); //str2 is "321cba"

EncodeBase64

string EncodeBase64()

将字符串进行Base64编码

用例:

string str1 = "abc123";
string base64 = str1.EncodeBase64(); //base64 is "YWJjMTIz"

DecodeBase64

string DecodeBase64()

Base64文本解码到字符串

用例:

string base64 = "YWJjMTIz";
string text = str1.DecodeBase64(); //text is "abc123456"

Clone this wiki locally