Show / Hide Table of Contents

Class StringUtilities

Contains some utility functions related to strings

Inheritance
object
StringUtilities
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class StringUtilities

Methods

| Edit this page View Source

AddNewLines(string)

All </br> statements get replaced with new-line characters. You can also use </br:10> for multiple lines (this creates 10 new-lines for example)

Declaration
public static string AddNewLines(string input)
Parameters
Type Name Description
string input
Returns
Type Description
string
| Edit this page View Source

AddSpaces(string)

All </sp> statements get replaced with space characters. You can also use </sp:10> for multiple spaces (this creates 10 new spaces for example)

Declaration
public static string AddSpaces(string input)
Parameters
Type Name Description
string input
Returns
Type Description
string
| Edit this page View Source

Pagify(IEnumerable<string>)

Adds page markers between strings so it can be used in a dialogue conversation

Declaration
public static string Pagify(IEnumerable<string> strings)
Parameters
Type Name Description
IEnumerable<string> strings

The strings to pagify

Returns
Type Description
string

Returns the final string with page separators

| Edit this page View Source

Pagify(params string[])

Adds page markers between strings so it can be used in a dialogue conversation

Declaration
public static string Pagify(params string[] strings)
Parameters
Type Name Description
string[] strings

The strings to pagify

Returns
Type Description
string

Returns the final string with page separators

| Edit this page View Source

Prettify(string)

Makes a string look nicer (example: converts "thisIsATest123" to "This is a test 123"

Declaration
public static string Prettify(string input)
Parameters
Type Name Description
string input

The input string

Returns
Type Description
string

The prettified string

| Edit this page View Source

TryFind(string, string, out int)

Tries to find the specified substring in the input string and returns the index of the first occurrence.

Declaration
public static bool TryFind(this string input, string strToFind, out int index)
Parameters
Type Name Description
string input

The input string to search within.

string strToFind

The substring to find.

int index

When this method returns, contains the zero-based index of the first occurrence of the substring, or -1 if the substring is not found.

Returns
Type Description
bool

True if the substring is found; otherwise, false.

| Edit this page View Source

TryFind(string, string, out int, out int)

Tries to find the specified substring in the input string and returns the start and end indices of the substring.

Declaration
public static bool TryFind(this string input, string strToFind, out int startIndex, out int endIndex)
Parameters
Type Name Description
string input

The input string to search within.

string strToFind

The substring to find.

int startIndex

When this method returns, contains the zero-based index of the first occurrence of the substring, or -1 if the substring is not found.

int endIndex

When this method returns, contains the zero-based index of the end of the substring, or -1 if the substring is not found.

Returns
Type Description
bool

True if the substring is found; otherwise, false.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾