Skip to content

A small library to help you manipulate strings without paying attention to supplementary characters.

License

Notifications You must be signed in to change notification settings

khamitimur/SurrogateFreeString

Repository files navigation

SurrogateFreeString

A small library to help you manipulate strings without paying attention to supplementary characters.

You can visit MSDN for detailed information about supplementary characters and surrogates.

How To

Create new SFString object by passing your string into a constructor.

string exampleString = @"This 👉 is 🅰 an example string with emojis 👨‍👩‍👧‍👧.";
SFString surrogateFreeString = new SFString(exampleString);

This will create a representation of your string where any surrogate pair will count as one symbol. After that you can manipulate it just like a string. Actually for now there are only Substring(int, int) and Substring(int) methods.

SFString firstTwoCharacters = surrogateFreeString.Substring(0, 2);
SFString allCharactersAfterFirstTwo = surrogateFreeString.Substring(2);

To get a string after you finished minupulations you wanted just use ToString().

var finalString = firstTwoCharacters.ToString();

License

This project is licensed under the WTFPL License.

About

A small library to help you manipulate strings without paying attention to supplementary characters.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages