static void Main(string[] args)
 {
     StringBuilder test = new StringBuilder();
     test.Append("wqewe ewqewq qrqwe");
     Console.WriteLine(test.Substring(2, 5));
     Console.WriteLine(test.RemoveText("qrq"));
 }
Example #2
0
    public static void Main(string[] args)
    {
        var builder = new StringBuilder();
        builder.Append("soskmlkdgmlalakm|AAAZ|dopkfdpokaaaz");
        builder.RemoveText("AAAZ");

        Console.WriteLine(builder.ToString());
    }
 public static void Main()
 {
     StringBuilder str = new StringBuilder();
     str.Append("Test extension methods for the class StringBuilder.");
     Console.WriteLine(str.Substring(5, 17));
     Console.WriteLine(str.RemoveText("methods"));
     IEnumerable<int> numbers = new List<int>() { 1, 2, 3, 4, 5 };
     Console.WriteLine(str.AppendAll<int>(numbers));
 }
Example #4
0
        static void Main()
        {
            StringBuilder text = new StringBuilder("Example text.");
            IEnumerable<int> list = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            Console.WriteLine(text.Substring(1, 3));
            Console.WriteLine(text.RemoveText("exa"));
            Console.WriteLine(text.AppendAll<int>(list));
        }
Example #5
0
    static void Main()
    {
        var str = new StringBuilder("Functional Programming");
        Console.WriteLine(str.Substring(0, 11));

        str = new StringBuilder("Functional funcTional Programming");
        Console.WriteLine(str.RemoveText("Functional"));
        Console.WriteLine(str.AppendAll(new string[]{" ", "one", " ", "two"}));
    }
Example #6
0
        public static void Main()
        {
            var extensionTest = new StringBuilder("Compelling data. Big ideas. Creative juice. Put Google research and insight behind your thinking.");
            var list = new List<string>() { "a", "b", "c", "d" };

            Console.WriteLine(extensionTest.GetSubstring(2, 10));
            extensionTest.RemoveText("Big ideas");
            Console.WriteLine(extensionTest);
            Console.WriteLine(extensionTest.AppendAll(list));
        }
 static void Main()
 {
     StringBuilder text = new StringBuilder("SoftUni");
     Console.WriteLine(text.Substring(4, 3));
     text.RemoveText("Uni");
     Console.WriteLine(text);
     List<int> integers = new List<int>() { 1, 2, 4, 5 };
     text.AppendAll(integers);
     Console.WriteLine(text);
 }
 static void Main()
 {
     StringBuilder str = new StringBuilder("georgi ivanov");
     IEnumerable<object> chars = new List<string>() { "georgiev", "ivanov" };
     Console.WriteLine(str.AppendAll(chars));
     string substring = str.Substring(4, 9);
     str.RemoveText("georgi ");
     Console.WriteLine(str);
     Console.WriteLine(substring);
 }
        public static void Main()
        {
            var text = new StringBuilder("I'm the grates Cezar of all times!");
            Console.WriteLine("Original phraze: {0}\n", text);

            Console.WriteLine("(Substring) - Name: {0}", text.Substring(15, 5));
            var list = new List<string>() { " As ", "we ", "all ", "are!" };
            Console.WriteLine("(AppendAll) - Some new words: {0}", text.AppendAll(list));
            Console.WriteLine("(RemoveText) - Remove name: {0}", text.RemoveText("Cezar"));
        }
 static void Main(string[] args)
 {
     StringBuilder s = new StringBuilder();
     s.Append("kaji babe \"thank u.\"");
     Console.WriteLine(string.Format("Text: \n{0}",s));
     Console.WriteLine("Substring with parameters [1,6]: \n"+s.Substr(1, 6));
     Console.WriteLine("Remove text'babe':\n"+s.RemoveText("babe"));
     s.AppendAll(new List<string>{" Mai " , "uakahme ", "neshatata ", "Pesho!"});
     Console.WriteLine(s);
 }
        public static void Main()
        {
            StringBuilder sb = new StringBuilder("Implement some extension methods for the class StringBuilder:");
            IEnumerable<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6 };

            Console.WriteLine(sb.Substring(8, 16));
            Console.WriteLine(sb.RemoveText("ion method"));
            Console.WriteLine(sb.AppendAll<int>(numbers));

            // Console.WriteLine(sb.AppendAll<long>(numbers)); //// compile time error
        }
        public static void Main()
        {
            StringBuilder sb = new StringBuilder("Write something else else else else?????");
            IEnumerable<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6 };

            Console.WriteLine(sb.Substring(16, 24));
            Console.WriteLine(sb.RemoveText("ion method"));
            Console.WriteLine(sb.AppendAll<int>(numbers));
            
            // Console.WriteLine(sb.AppendAll<long>(numbers)); //// compile time error
        }
Example #13
0
        static void Main(string[] args)
        {
            var sb = new StringBuilder();
            sb.Append("This is long long long text");
            Console.WriteLine(sb.Substring(5, sb.Length - 5));

            sb.RemoveText("long");
            Console.WriteLine(sb.ToString());

            sb.AppendAll(Enumerable.Range(0, 5));
            Console.WriteLine(sb.ToString());
        }
        public static void Main()
        {
            StringBuilder sb = new StringBuilder("asfsfdgd");
            Console.WriteLine(sb.Substring(5, 3));
            Console.WriteLine(sb.Substring(5, 5));

            sb.RemoveText("sf");
            Console.WriteLine(sb);

            List<int> numbers = new List<int>() { 1, 2, 3, 4, 5 };

            sb.AppendAll(numbers);
            Console.WriteLine(sb);
        }
        public static void Main()
        {
            StringBuilder mySb = new StringBuilder("Lorem ipsum loremlorem obenadi");

            Console.WriteLine(mySb.Substring(1, 10));
            mySb = mySb.RemoveText("lorem");

            mySb = mySb.AppendAll(new List<string>()
            {
                "valeri", "asen"
            });

            Console.WriteLine(mySb);
        }
Example #16
0
    static void Main()
    {
        StringBuilder text = new StringBuilder("Write a program to demonstrate that your new extension methods work correctly.");
        IEnumerable<double> doubles = new List<double>() { 5.3, 2.5, 4.23 };

        string substr = text.Substring(8, 7);
        Console.WriteLine(substr);

        StringBuilder sb = new StringBuilder();
        sb = text.RemoveText("write ");
        Console.WriteLine(sb);

        StringBuilder sbAppend = new StringBuilder();
        sbAppend = text.AppendAll(doubles);
        Console.WriteLine(sbAppend);
    }
        public static void Main(string[] args)
        {
            StringBuilder strb = new StringBuilder("I really like my name: Ginka, GINKA, GiNkA, gInKa, GInka, GINka");

            var substr = strb.Substring(2, 15);
            Console.WriteLine(substr);

            strb.RemoveText("ginka");
            Console.WriteLine(strb.ToString());

            var numbers = new List<double> { 2.34, 3.456, 0.2345 };
            var words = new List<string> { "abra", "kadabra" };
            strb.AppendAll(numbers);
            Console.WriteLine(strb);
            strb.AppendAll(words);
            Console.WriteLine(strb);
        }
Example #18
0
        public static void Main()
        {
            StringBuilder test = new StringBuilder("toMAtoes aRe cOol");
            Console.WriteLine(test.Substring(2, 4));

            test.RemoveText(" ArE");
            Console.WriteLine(test);

            test.Clear();
            string[] words = { "pesho", "gosho", "vanko", "kiro", "jojo" };
            test.AppendAll(words);
            Console.WriteLine(test);

            List<int> nums = new List<int>() { 1, 3, 15, 24, 99 };
            test.Append(" ");
            test.AppendAll(nums);
            Console.WriteLine(test);
        }
Example #19
0
        static void Main(string[] args)
        {
            StringBuilder tmp = new StringBuilder("Pesho, Kiro, kiro, Stamat");

            int[] nums = new int[5]{1, 2, 3, 4, 5};
            List<string> names = new List<string> { "Evgeni", "Lora", "Bai Ivan" };

            String subStr = tmp.SubString(7, 4);
            Console.WriteLine(subStr);
            Console.WriteLine();

            Console.WriteLine(tmp.RemoveText(" kiro,"));
            Console.WriteLine();

            tmp.AppendAll<int>(nums);
            tmp.AppendAll<string>(names);
            Console.WriteLine(tmp);
        }
        public static void Main()
        {
            StringBuilder stringBuilder = new StringBuilder("The quick brown fox jumps over the lazy dog");
            Console.WriteLine("Original text: " + stringBuilder);

            string subString = stringBuilder.Substring(10, 9);
            Console.WriteLine("Substring: " + subString);

            Console.WriteLine("Remove 'the' ( case-insensitive ): " + stringBuilder.RemoveText("the"));

            IEnumerable<double> numbers = new List<double>()
            {
                42,
                3.14,
                5.11,
                1.68
            };
            Console.WriteLine("Append all numbers: " + stringBuilder.AppendAll(numbers));
        }
    private static void Main()
    {
        string testSubstring = "abcde";
        testSubstring = testSubstring.Substring(4, 1);
        Console.WriteLine(testSubstring);

        StringBuilder testRemoveString = new StringBuilder("Softuruniurur");
        testRemoveString.RemoveText("ur");
        Console.WriteLine(testRemoveString);

        int[] headArrayInt = { 1, 2, 3, 4, 5 };
        int[] tailArrayInt = { 6, 7, 8 };
        string apended = headArrayInt.AppendAll<int>(tailArrayInt);
        Console.WriteLine(apended);

        string[] headArrayString = { "Rock", " and", " roll" };
        string[] tailArrayString = { " ba", "by !" };
        apended = headArrayString.AppendAll<string>(tailArrayString);
        Console.WriteLine(apended);
    }
Example #22
0
        public static void Main()
        {
            StringBuilder test = new StringBuilder("Petar e golqm pich petar Petar! :)");
            string SubStringTest=test.Substring(4, test.Length);
            Console.WriteLine(SubStringTest);
            test.RemoveText("Petar");
            Console.WriteLine(test);

            List<int> TestListOne = new List<int>();
            List<string> TestListTwo = new List<string>();

            TestListOne.Add(1);
            TestListOne.Add(2);
            TestListTwo.Add("Petar");
            TestListTwo.Add("Rusev");
            TestListTwo.Add("Rusev");
            test.Clear();
            test.AppendAll(TestListOne);
            test.AppendAll(TestListTwo);
            Console.WriteLine(test);

        }
        static void Main(string[] args)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string hi = "high";
            stringBuilder.Append(hi);
            string substringedString = stringBuilder.Substring(0, 3);
            Console.WriteLine("Before substring: {0}\nAfter substring: {1}", stringBuilder, substringedString);
            Console.WriteLine();

            string removeString = "GH";
            Console.WriteLine("String to remove from: {0}\nPart to be removed: {1}", stringBuilder, removeString);
            stringBuilder.RemoveText(removeString);
            Console.WriteLine("After removing: {0}", stringBuilder);

            stringBuilder = new StringBuilder();
            List<int> numbers = new List<int>();
            numbers.Add(1);
            numbers.Add(2);
            numbers.Add(3);
            numbers.Add(4);

            stringBuilder.AppendAll(numbers);
            Console.WriteLine(stringBuilder);
        }