# StringExtensionMethods class

Namespace: [Grasshopper2.Extensions](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.extensions.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public static class StringExtensionMethods
```

Extension methods for System.String

## Methods

- [Break](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/break.md): (static) Try and break a string into a fixed number of fragments at custom characters.
- [CollapseWhiteSpace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/collapsewhitespace.md): (static) Collapse all whitespace runs with a single symbol.
- [CommonOverlap](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/commonoverlap.md): (static) Gets the string which is the common overlap (at the start) of both strings.
- [CompressedStringToGuid](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/compressedstringtoguid.md): (static) Convert a short string representation into a Guid.
- [Consume](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/consume.md): (2 overloads, static) Consume up to a specific number of characters from the start of the string.
- [ConsumeUntil](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/consumeuntil.md): (static) Consume a set of characters from the start of the string until a specified character appears.
- [Contains](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/contains.md): (static) Perform advanced containment test.
- [ContainsIsolated](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/containsisolated.md): (2 overloads, static) Test to see whether a string contains another string, surrounded by non-alphanumeric characters.
- [Count](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/count.md): (3 overloads, static) Count the number of times a specific character occurs in this string.
- [DecodeEscapedCharacters](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/decodeescapedcharacters.md): (static) Decode escaping of special characters like '¶', '\t', '\n' and unicode codepoints: '\u00A0'.
- [DecodeWhitespace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/decodewhitespace.md): (static) Decode (i.e. un-escape) various kinds of non-whitespace characters using whitespace characters.
- [DropSuperScript](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/dropsuperscript.md): (static) Convert a superscript character into a regular character.
- [EncodeWhitespace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/encodewhitespace.md): (static) Encode (i.e. escape) various kinds of whitespace characters using non-whitespace characters.
- [EndsWithBeforeWhitespace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/endswithbeforewhitespace.md): (static) Test whether a string ends with a given character, ignoring trialing whitespace.
- [EqualsAny](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/equalsany.md): (static) Check whether a string is equal to any one of a set of strings.
- [Find](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/find.md): (2 overloads, static) Finds all the occurrences of a character within a substring.
- [FindAll](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findall.md): (2 overloads, static) Find all occurrences of a specific set of characters.
- [FindIsolated](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findisolated.md): (2 overloads, static) Find the first isolated occurence of one string within another. Isolated in this case means not surrounded on either side by alphanumeric characters or underscores.
- [FindLineStart](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findlinestart.md): (static) Find the index within the string where the line is said to start. If we're past the leading whitespace of the line, this will return the index of the last char in the leading whitespace. If we're already in the leading whitespace, zero is returned.
- [FindMatchingBrace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findmatchingbrace.md): (static) Find a matching brace pair.
- [FindNext](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findnext.md): (static) Find the next occurance of a specific character in this string.
- [FindSymbolRegion](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findsymbolregion.md): (static) Starting from the character at text[seed], find all identical adjacent characters.
- [FindWhiteRegion](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findwhiteregion.md): (static) Starting from the character at text[seed], find all adjacent whitespace in either direction.
- [FindWordRegion](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/findwordregion.md): (static) Starting from the character at text[seed], find all adjacent word or numberlike characters in either direction.
- [GraphemeCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/graphemecount.md): (static) Gets the number of grapheme clusters in the text.
- [GraphemeToCodeUnit](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/graphemetocodeunit.md): (static) Converts a grapheme-cluster index into the code-unit offset at which that cluster begins (clamped to the string length).
- [IsHexDigit](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/ishexdigit.md): (static) Test whether a char qualifies as a hexadecimal digit.
- [IsSingleLineString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/issinglelinestring.md): (static) Gets whether a string is single or multi-line.
- [NextTransition](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/nexttransition.md): (static) Find the index within the string where the next meaningful transition occurs.
- [OffsetAndAlign](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/offsetandalign.md): (3 overloads, static) Offset an array of strings by inserting whitespace at the start until the specified characters are all as close as possible to left aligned.
- [PadToWidest](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/padtowidest.md): (static) Append whitespace to the end of lines until they're all as long as the longest one.
- [PrevTransition](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/prevtransition.md): (static) Find the index within the string where the previous meaningful transition occurs.
- [RemoveAll](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/removeall.md): (3 overloads, static) Remove all occurrences of a set of characters.
- [RemoveSurroundingBraces](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/removesurroundingbraces.md): (static) Remove matching braces which delimit a string.
- [RemoveWhiteSpace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/removewhitespace.md): (2 overloads, static) Remove all whitespace from a string.
- [Replace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/replace.md): (5 overloads, static) Replace all characters with a single other character.
- [ReplaceRepeatedly](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/replacerepeatedly.md): (static) Replace a set of characters with another until the string no longer changes.
- [SimplifyNewLines](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/simplifynewlines.md): (static) Reduce all newline codes in a string and replace them with a single new code.
- [SplitAtChar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/splitatchar.md): (static) Split a string using repetitions of a specific character.
- [SplitAtIndex](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/splitatindex.md): (static) Split a string into several segments based on splitting indices.
- [SplitLines](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/splitlines.md): (static) Split a string into individual lines.
- [StartsWithAfterWhitespace](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/startswithafterwhitespace.md): (static) Test whether a string starts with a given character, ignoring leading whitespace.
- [Strip](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/strip.md): (3 overloads, static) Remove all characters from a string.
- [StripAllExcept](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/stripallexcept.md): (2 overloads, static) Remove all characters except the ones specified.
- [Substring](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/substring.md): (4 overloads, static) Get a substring using indices.
- [SubstringByGraphemes](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/substringbygraphemes.md): (2 overloads, static) Gets the substring covering `countGraphemes` clusters starting at the given grapheme-cluster index.
- [SuperImpose](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/superimpose.md): (static) Create a new guid by bit-wise superposition of two existing guids.
- [ToCompressedString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/tocompressedstring.md): (static) Convert a Guid to a short string representation.
- [ToRegexPattern](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/toregexpattern.md): (static) Convert a string with wildcard characters (* and ?) into a regular expression matching string.
- [ToString](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/tostring.md): (static) Create a string containing only the first few hexadecimal digits of a guid.
- [ToStringArray](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/tostringarray.md): (static) Convert a string into loose text elements. This is similar to the string.ToCharArray() method except it correctly combines surrogates and diacritics into individual strings. This method merely iterates over the string using System.Globalization.TextElementEnumerator.
- [Trim](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/trim.md): (static) Trim a string to a certain length.
- [TrimEnd](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/trimend.md): (static) Remove a maximum number of occurences of a set of characters from the end of a string.
- [TrimStart](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/trimstart.md): (static) Remove a maximum number of occurences of a set of characters from the start of a string.
- [UnquoteDouble](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/unquotedouble.md): (static) Remove the leading and trailing double quotes from a string.
- [UnquoteSingle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/unquotesingle.md): (static) Remove the leading and trailing single quotes from a string.
- [WildcardMatch](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/wildcardmatch.md): (2 overloads, static) Test to see whether this string matches a wildcard pattern. Pattern may contain asterisks (for matching any amount of characters) and question marks (for matching single characters).
- [Words](https://developer.rhino3d.com/api/gh2/type/grasshopper2.extensions.stringextensionmethods/words.md): (static) Enumerate over all the words in a string. This iterator treats all whitespace and non-alpha-numeric characters as word separators.
