@@ -1684,7 +1684,7 @@ public static string FormatWith(this string source, params object[] args)
16841684 }
16851685
16861686 /// <summary>
1687- /// A string extension method that if contains.
1687+ /// A string extension method that check if source contains.
16881688 /// </summary>
16891689 /// <param name="source">The input.</param>
16901690 /// <param name="searchValue">The search value.</param>
@@ -1698,7 +1698,7 @@ public static string IfContains(this string source, string searchValue, string r
16981698 }
16991699
17001700 /// <summary>
1701- /// A string extension method that if not contains.
1701+ /// A string extension method that check if source not contains.
17021702 /// </summary>
17031703 /// <param name="source">The input.</param>
17041704 /// <param name="searchValue">The search value.</param>
@@ -1710,5 +1710,33 @@ public static string IfNotContains(this string source, string searchValue, strin
17101710 {
17111711 return source . Contains ( searchValue ) . IsFalse ( ) ? resultValue : source ;
17121712 }
1713+
1714+ /// <summary>
1715+ /// A string extension method that check if source starts with.
1716+ /// </summary>
1717+ /// <param name="source">The input.</param>
1718+ /// <param name="searchValue">The search value.</param>
1719+ /// <param name="resultValue">Default value to return.</param>
1720+ /// <returns>
1721+ /// A string.
1722+ /// </returns>
1723+ public static string IfStartsWith ( this string source , string searchValue , string resultValue )
1724+ {
1725+ return source . StartsWith ( searchValue ) . IsTrue ( ) ? resultValue : source ;
1726+ }
1727+
1728+ /// <summary>
1729+ /// A string extension method that check if source not starts with.
1730+ /// </summary>
1731+ /// <param name="source">The input.</param>
1732+ /// <param name="searchValue">The search value.</param>
1733+ /// <param name="resultValue">Default value to return.</param>
1734+ /// <returns>
1735+ /// A string.
1736+ /// </returns>
1737+ public static string IfNotStartsWith ( this string source , string searchValue , string resultValue )
1738+ {
1739+ return source . StartsWith ( searchValue ) . IsFalse ( ) ? resultValue : source ;
1740+ }
17131741 }
17141742}
0 commit comments