maxkoryukov / ContentGrabber.Addon

ContentGrabber.Addon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ContentGrabber.Addon

FAQ

Where are sources?

Direct link to the source code - this is the link to the folder in this repository (which contains C# source code of ContentGrabber.Addon and tests for it).

I need an assembly, where I could get it?

There are RELEASES PAGE with all published releases of the library. Each release contains the section Downloads, and there is a file ContentGrabber.Addon.dll - this is the final DLL (Assembly), suitable for downloading and using with Content Grabber.

Just choose the latest release (usually - on the top of Releases page), and download the file ContentGrabber.Addon.dll.

About latest release: we follow the semantic versioning in this project


About this repo

Build status codecov

Functions

All really actual and working samples are in tests

Run BAT

		public void Bat01() {

			var path = System.IO.Path.Combine("ContentGrabber.Addon.Test", "Bat", "echo.bat");
			ContentGrabber.Addon.Bat.Exec(path);
			Assert.True(true);
		}

Pretty Language

Use as static method:

		public void PrettyLanguage01() {

			// add to the top of file:
			// using ContentGrabber.Addon.Ext;

			var pretty = StringExt.PrettyLanguage("<tr><td>ITALIAN<");
			Assert.That(pretty, Is.EqualTo("Italian;"));
		}

Or as string-extension:

		public void PrettyLanguage02() {
			// add to the top of file:
			// using ContentGrabber.Addon.Ext;
			var pretty ="<tr><td>ITALIAN<".PrettyLanguage();
			Assert.That(pretty, Is.EqualTo("Italian;"));
		}

Join multiple strings

Use as static method:

		public void JoinNonEmpty01() {
			var s001 = "a";
			var s002 = "";
			var s003 = "xxxxx";
			string s004 = null;
			var s005 = "123";

			var joined = StringExt.JoinNonEmpty(
				" | ",
				s001,
				s002,
				s003,
				s004,
				s005
				/* s006 .... as many as you wish */
			);
			Assert.That(joined, Is.EqualTo("a | xxxxx | 123"));
		}

Or as string-extension:

		public void JoinNonEmpty02() {
			// add to the top of file:
			// using ContentGrabber.Addon.Ext;

			var s001 = "a";
			var s002 = "";
			var s003 = "xxxxx";
			string s004 = null;
			var s005 = "123";

			var joined = " | ".JoinNonEmpty(
				s001,
				s002,
				s003,
				s004,
				s005
				/* s006 .... as many as you wish */
			);
			Assert.That(joined, Is.EqualTo("a | xxxxx | 123"));
		}

String contains substring

Test shows, that default string.Contains works fast enough.

Here is a test run CustomContains vs LibContains: https://ci.appveyor.com/project/maxkoryukov/contentgrabber-addon/build/0.2.1.18-0.2.1#L78

And here: http://disq.us/p/1f8wxjc

Meanwhile, there are two extension methods for string:

  1. ContainsCustom , implementing T1 from strange article
  2. ContainsLib, just a wrapper around string.Contains

which you could use for your purpopses.

But it is strongly recommended to use default string.Contains method.

String contains one of three(any number) strings

Use as string-extension:

		public void ContainsAny02() {
			// add to the top of file:
			// using ContentGrabber.Addon.Ext;.Ext;

			var result = "one two three".ContainsAny("one", "two", "three");
			Assert.That(result, Is.True);
		}

About

ContentGrabber.Addon


Languages

Language:C# 99.9%Language:Batchfile 0.1%