Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
StringSpanExtensions.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 namespace SiliconStudio.Core
4 {
5  public static class StringSpanExtensions
6  {
7  /// <summary>
8  /// Gets the substring with the specified span. If the span is invalid, return null.
9  /// </summary>
10  /// <param name="str">The string.</param>
11  /// <param name="span">The span.</param>
12  /// <returns>A substring with the specified span or null if span is empty.</returns>
13  public static string Substring(this string str, StringSpan span)
14  {
15  return span.IsValid ? str.Substring(span.Start, span.Length) : null;
16  }
17  }
18 }
static string Substring(this string str, StringSpan span)
Gets the substring with the specified span. If the span is invalid, return null.
A region of character in a string.
Definition: StringSpan.cs:12