diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
index d433fff59b..c7e1bef3b2 100644
--- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
+++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
@@ -119,6 +119,7 @@ public static class AbpStringExtensions
/// The string.
/// one or more postfix.
/// Modified string or the same string if it has not any of given postfixes
+ [ContractAnnotation("null <= str:null")]
public static string RemovePostFix(this string str, params string[] postFixes)
{
return str.RemovePostFix(StringComparison.Ordinal, postFixes);
@@ -131,6 +132,7 @@ public static class AbpStringExtensions
/// String comparison type
/// one or more postfix.
/// Modified string or the same string if it has not any of given postfixes
+ [ContractAnnotation("null <= str:null")]
public static string RemovePostFix(this string str, StringComparison comparisonType, params string[] postFixes)
{
if (str.IsNullOrEmpty())
@@ -160,6 +162,7 @@ public static class AbpStringExtensions
/// The string.
/// one or more prefix.
/// Modified string or the same string if it has not any of given prefixes
+ [ContractAnnotation("null <= str:null")]
public static string RemovePreFix(this string str, params string[] preFixes)
{
return str.RemovePreFix(StringComparison.Ordinal, preFixes);
@@ -172,6 +175,7 @@ public static class AbpStringExtensions
/// String comparison type
/// one or more prefix.
/// Modified string or the same string if it has not any of given prefixes
+ [ContractAnnotation("null <= str:null")]
public static string RemovePreFix(this string str, StringComparison comparisonType, params string[] preFixes)
{
if (str.IsNullOrEmpty())
@@ -264,6 +268,7 @@ public static class AbpStringExtensions
/// set true to use current culture. Otherwise, invariant culture will be used.
/// set true to if you want to convert 'XYZ' to 'xyz'.
/// camelCase of the string
+ [ContractAnnotation("null <= str:null")]
public static string ToCamelCase(this string str, bool useCurrentCulture = false, bool handleAbbreviations = false)
{
if (string.IsNullOrWhiteSpace(str))
@@ -290,6 +295,7 @@ public static class AbpStringExtensions
///
/// String to convert.
/// set true to use current culture. Otherwise, invariant culture will be used.
+ [ContractAnnotation("null <= str:null")]
public static string ToSentenceCase(this string str, bool useCurrentCulture = false)
{
if (string.IsNullOrWhiteSpace(str))
@@ -307,6 +313,7 @@ public static class AbpStringExtensions
///
/// String to convert.
/// set true to use current culture. Otherwise, invariant culture will be used.
+ [ContractAnnotation("null <= str:null")]
public static string ToKebabCase(this string str, bool useCurrentCulture = false)
{
if (string.IsNullOrWhiteSpace(str))
@@ -440,6 +447,7 @@ public static class AbpStringExtensions
/// String to convert
/// set true to use current culture. Otherwise, invariant culture will be used.
/// PascalCase of the string
+ [ContractAnnotation("null <= str:null")]
public static string ToPascalCase(this string str, bool useCurrentCulture = false)
{
if (string.IsNullOrWhiteSpace(str))
@@ -458,7 +466,7 @@ public static class AbpStringExtensions
///
/// Gets a substring of a string from beginning of the string if it exceeds maximum length.
///
- /// Thrown if is null
+ [ContractAnnotation("null <= str:null")]
public static string Truncate(this string str, int maxLength)
{
if (str == null)
@@ -477,7 +485,7 @@ public static class AbpStringExtensions
///
/// Gets a substring of a string from Ending of the string if it exceeds maximum length.
///
- /// Thrown if is null
+ [ContractAnnotation("null <= str:null")]
public static string TruncateFromBeginning(this string str, int maxLength)
{
if (str == null)
@@ -510,6 +518,7 @@ public static class AbpStringExtensions
/// Returning string can not be longer than maxLength.
///
/// Thrown if is null
+ [ContractAnnotation("null <= str:null")]
public static string TruncateWithPostfix(this string str, int maxLength, string postfix)
{
if (str == null)