🖌️
FC.Extension
  • FC.Extension
  • How to Use?
  • Release Note
  • FC.Extension.List
    • ToDataTable
  • FC.Extension.Date
    • Age
  • FC.Extension.String
    • Encrypt
    • Decrypt
    • Truncate a String
  • SQL
    • SQL Extension
    • PostgreSQL Extension
Powered by GitBook
On this page
  • Truncate
  • Package
  • Sample Code
  • Output

Was this helpful?

  1. FC.Extension.String

Truncate a String

Truncate a string with a specified Length

Truncate

The below method truncates a string to a given specified length

Package

Install-Package FC.Core.Extension -Version 5.0.1

Sample Code

[Theory]
[InlineData("This was the value to be truncted", 5)]
[InlineData("Truncated output", 10)]

public void TruncateTest_Test(string value, int length)
{
    string output = value.Truncate(length);            
    _output.WriteLine(output);
    output.ShouldNotBeEmpty();
}

Output

PreviousDecryptNextSQL Extension

Last updated 3 years ago

Was this helpful?