StringExtensionsCountLines Method
Namespace: DevCase.Extensions.StringExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static int CountLines(
this string str
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function CountLines (
str As String
) As Integer
Dim str As String
Dim returnValue As Integer
returnValue = str.CountLines()
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static int CountLines(
String^ str
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member CountLines :
str : string -> int
No code example is currently available or this language may not be supported.
- str String
-
The source String.
Int32
The amount of lines in the source
String.
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
It's recommended to use this function instead of:
String.Split({Environment.NewLine}, StringSplitOptions.None).Length,
to avoid allocating new objects that will provoke memory issues when parsing very large strings.
This is a code example.
No code example is currently available or this language may not be supported.
Dim value As String =
"Line 1
Line 2
Line 3
Line 5
" ' This string has six lines.
Dim lineCount As Integer = str.CountLines(value)
Console.WriteLine(lineCount)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.