Skip to content
This repository was archived by the owner on Aug 22, 2019. It is now read-only.

Latest commit

 

History

History
28 lines (24 loc) · 593 Bytes

README.md

File metadata and controls

28 lines (24 loc) · 593 Bytes

C#-String-Extensions

String pad left and right by bytes, align (cut & pad) left and right by bytes.

Language

C#

How to Use

Download StringExtension.cs file and add it into project, or download StringExtension.dll and add referance to project, and using namespace CustomExtensions.

Four method:

  • PadRightBytes
  • PadLeftBytes
  • AlignRightBytes
  • AlignleftBytes

e.g.

static void Main(string[] args)
{
    string str = "ABCDE測試";
    int i = 8;
    str = str.AlignRightBytes(i, 'Z');
    Console.WriteLine(str);
    Console.ReadLine();
}

Result will be: ABCDE測Z