WeixiangYan/CodeTransOcean huggingface dataset:
Task: Multisplit

C: #include <stdio.h>
#include <string.h>

void parse_sep(const char *str, const char *const *pat, int len)
{
	int i, slen;
	while (*str != '\0') {
		for (i = 0; i < len || !putchar(*(str++)); i++) {
			slen = strlen(pat[i]);
			if (strncmp(str, pat[i], slen)) continue;
			printf("{%.*s}", slen, str);
			str += slen;
			break;
		}
	}
}

int main()
{
	const char *seps[] = { "==", "!=", "=" };
	parse_sep("a!===b=!=c", seps, 3);

	return 0;
}
Task: Multisplit



C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Multisplit
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            foreach (var s in "a!===b=!=c".Multisplit(true, "==", "!=", "=")) 
            {
                Console.Write(s); 
            }
            Console.WriteLine();
        }

        private static IEnumerable<string> Multisplit(this string s, bool returnSeparators = false,
                                                      params string[] delimiters)
        {
            var currentString = new StringBuilder(); 

            int index = 0; 

            while (index < s.Length) 
            {
                
                string foundDelimiter =
                    (from delimiter in delimiters
                     where s.Length >= index + delimiter.Length &&
                           s.Substring(index, delimiter.Length) == delimiter
                     select delimiter).FirstOrDefault();

                if (foundDelimiter != null)
                {
                    yield return currentString.ToString(); 
                    if (returnSeparators) 
                        yield return
                            string.Format("{{\"{0}\", ({1}, {2})}}",
                                          foundDelimiter,
                                          index, index + foundDelimiter.Length);
                    currentString.Clear(); 
                    index += foundDelimiter.Length; 
                }
                else
                {
                    currentString.Append(s[index++]); 
                }
            }

            if (currentString.Length > 0)
                yield return currentString.ToString(); 
        }
    }
}
Task: Multisplit


C++: #include <iostream>
#include <boost/tokenizer.hpp>
#include <string>

int main( ) {
   std::string str( "a!===b=!=c" ) , output ;
   typedef boost::tokenizer<boost::char_separator<char> > tokenizer ;
   boost::char_separator<char> separator ( "==" , "!=" ) , sep ( "!" )  ;
   tokenizer mytok( str , separator ) ;
   tokenizer::iterator tok_iter = mytok.begin( ) ;
   for ( ; tok_iter != mytok.end( ) ; ++tok_iter )
      output.append( *tok_iter ) ;
   tokenizer nexttok ( output , sep ) ;
   for ( tok_iter = nexttok.begin( ) ; tok_iter != nexttok.end( ) ;
	 ++tok_iter ) 
      std::cout << *tok_iter << " " ;
   std::cout << '\n' ;
   return 0 ;
}
Task: Multisplit





Java: import java.util.*;

public class MultiSplit {

    public static void main(String[] args) {
        System.out.println("Regex split:");
        System.out.println(Arrays.toString("a!===b=!=c".split("==|!=|=")));

        System.out.println("\nManual split:");
        for (String s : multiSplit("a!===b=!=c", new String[]{"==", "!=", "="}))
            System.out.printf("\"%s\" ", s);
    }

    static List<String> multiSplit(String txt, String[] separators) {
        List<String> result = new ArrayList<>();
        int txtLen = txt.length(), from = 0;

        for (int to = 0; to < txtLen; to++) {
            for (String sep : separators) {
                int sepLen = sep.length();
                if (txt.regionMatches(to, sep, 0, sepLen)) {
                    result.add(txt.substring(from, to));
                    from = to + sepLen;
                    to = from - 1; 
                    break;
                }
            }
        }
        if (from < txtLen)
            result.add(txt.substring(from));
        return result;
    }
}
Task: Multisplit







Python: >>> import re
>>> def ms2(txt="a!===b=!=c", sep=["==", "!=", "="]):
	if not txt or not sep:
		return []
	ans = m = []
	for m in re.finditer('(.*?)(?:' + '|'.join('('+re.escape(s)+')' for s in sep) + ')', txt):
		ans += [m.group(1), (m.lastindex-2, m.start(m.lastindex))]
	if m and txt[m.end(m.lastindex):]:
		ans += [txt[m.end(m.lastindex):]]
	return ans

>>> ms2()
['a', (1, 1), '', (0, 3), 'b', (2, 6), '', (1, 7), 'c']
>>> ms2(txt="a!===b=!=c", sep=["=", "!=", "=="])
['a', (1, 1), '', (0, 3), '', (0, 4), 'b', (0, 6), '', (1, 7), 'c']
Task: Multisplit








VB: Function multisplit(s,sep)
	arr_sep = Split(sep,"|")
	For i = 0 To UBound(arr_sep)
		arr_s = Split(s,arr_sep(i))
		s = Join(arr_s,",")
	Next
	multisplit = s
End Function
 
Function multisplit_extra(s,sep)
	Set dict_sep = CreateObject("Scripting.Dictionary")
	arr_sep = Split(sep,"|")
	For i = 0 To UBound(arr_sep)
		dict_sep.Add i,"(" & arr_sep(i) & ")"
		arr_s = Split(s,arr_sep(i))
		s = Join(arr_s,i)
	Next
	For Each key In dict_sep.Keys
		s = Replace(s,key,dict_sep.Item(key))
	Next
	multisplit_extra = s
End Function
 
WScript.StdOut.Write "Standard: " & multisplit("a!===b=!=c","!=|==|=")
WScript.StdOut.WriteLine
WScript.StdOut.Write "Extra Credit: " & multisplit_extra("a!===b=!=c","!=|==|=")
WScript.StdOut.WriteLine
Task: Multisplit




Go: package main

import (
    "fmt"
    "strings"
)

func ms(txt string, sep []string) (ans []string) {
    for txt > "" {
        sepMatch := ""
        posMatch := len(txt)
        for _, s := range sep {
            if p := strings.Index(txt, s); p >= 0 && p < posMatch {
                sepMatch = s
                posMatch = p
            }
        }
        ans = append(ans, txt[:posMatch])
        txt = txt[posMatch+len(sepMatch):]
    }
    return
}

func main() {
    fmt.Printf("%q\n", ms("a!===b=!=c", []string{"==", "!=", "="}))
}
Task: Binary strings



C#: using System;

class Program
{
    static void Main()
    {
        
        var x = "hello world";

        
        x = null;

        
        x = "ab\0";
        Console.WriteLine(x);
        Console.WriteLine(x.Length); 

        
        if (x == "hello")
            Console.WriteLine("equal");
        else
            Console.WriteLine("not equal");

        if (x.CompareTo("bc") == -1)
            Console.WriteLine("x is lexicographically less than 'bc'");

        
        var c = new char[3];
        x.CopyTo(0, c, 0, 3);
        object objecty = new string(c);
        var y = new string(c);

        Console.WriteLine(x == y);      
        Console.WriteLine(x.Equals(y)); 

        Console.WriteLine(x == objecty); 

        
        var empty = "";
        string nullString = null;
        var whitespace = "   ";
        if (nullString == null && empty == string.Empty && 
            string.IsNullOrEmpty(nullString) && string.IsNullOrEmpty(empty) &&
            string.IsNullOrWhiteSpace(nullString) && string.IsNullOrWhiteSpace(empty) &&
            string.IsNullOrWhiteSpace(whitespace))
            Console.WriteLine("Strings are null, empty or whitespace");

        
        x = "helloworld";
        x += (char)83;
        Console.WriteLine(x);

        
        var slice = x.Substring(5, 5);
        Console.WriteLine(slice);

        
        var greeting = x.Replace("worldS", "");
        Console.WriteLine(greeting);

        
        var join = greeting + " " + slice;
        Console.WriteLine(join);
    }
}









Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct str_t {
	size_t len, alloc;
	unsigned char *s;
} bstr_t, *bstr;

#define str_len(s) ((s)->len)
bstr str_new(size_t len)
{
	bstr s = malloc(sizeof(bstr_t));
	if (len < 8) len = 8;
	s->alloc = len;
	s->s = malloc(len);
	s->len = 0;
	return s;
}

void str_extend(bstr s)
{
	size_t ns = s->alloc * 2;
	if (ns - s->alloc > 1024) ns = s->alloc + 1024;
	s->s = realloc(s->s, ns);
	s->alloc = ns;
}

void str_del(bstr s)
{
	free(s->s), free(s);
}

int str_cmp(bstr l, bstr r)
{
	int res, len = l->len;
	if (len > r->len) len = r->len;

	if ((res = memcmp(l->s, r->s, len))) return res;
	return l->len > r->len ? 1 : -1;
}

bstr str_dup(bstr src)
{
	bstr x = str_new(src->len);
	memcpy(x->s, src->s, src->len);
	x->len = src->len;
	return x;
}

bstr str_from_chars(const char *t)
{
	if (!t) return str_new(0);
	size_t l = strlen(t);
	bstr x = str_new(l + 1);
	x->len = l;
	memcpy(x->s, t, l);
	return x;
}

void str_append(bstr s, unsigned char b)
{
	if (s->len >= s->alloc) str_extend(s);
	s->s[s->len++] = b;
}

bstr str_substr(bstr s, int from, int to)
{
	if (!to) to = s->len;
	if (from < 0) from += s->len;
	if (from < 0 || from >= s->len)
		return 0;
	if (to < from) to = from + 1;
	bstr x = str_new(to - from);
	x->len = to - from;
	memcpy(x->s, s->s + from, x->len);
	return x;
}

bstr str_cat(bstr s, bstr s2)
{
	while (s->alloc < s->len + s2->len) str_extend(s);
	memcpy(s->s + s->len, s2->s, s2->len);
	s->len += s2->len;
	return s;
}

void str_swap(bstr a, bstr b)
{
	size_t tz;
	unsigned char *ts;
	tz = a->alloc; a->alloc = b->alloc; b->alloc = tz;
	tz = a->len; a->len = b->len; b->len = tz;
	ts = a->s; a->s = b->s; b->s = ts;
}

bstr str_subst(bstr tgt, bstr pat, bstr repl)
{
	bstr tmp = str_new(0);
	int i;
	for (i = 0; i + pat->len <= tgt->len;) {
		if (memcmp(tgt->s + i, pat->s, pat->len)) {
			str_append(tmp, tgt->s[i]);
			i++;
		} else {
			str_cat(tmp, repl);
			i += pat->len;
			if (!pat->len) str_append(tmp, tgt->s[i++]);
		}
	}
	while (i < tgt->len) str_append(tmp, tgt->s[i++]);
	str_swap(tmp, tgt);
	str_del(tmp);
	return tgt;
}

void str_set(bstr dest, bstr src)
{
	while (dest->len < src->len) str_extend(dest);
	memcpy(dest->s, src->s, src->len);
	dest->len = src->len;
}

int main()
{
	bstr s = str_from_chars("aaaaHaaaaaFaaaaHa");
	bstr s2 = str_from_chars("___.");
	bstr s3 = str_from_chars("");

	str_subst(s, s3, s2);
	printf("%.*s\n", s->len, s->s);

	str_del(s);
	str_del(s2);
	str_del(s3);

	return 0;
}











Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings


C++: #include <iomanip>
#include <iostream>

using namespace std;

string replaceFirst(string &s, const string &target, const string &replace) {
    auto pos = s.find(target);
    if (pos == string::npos) return s;
    return s.replace(pos, target.length(), replace);
}

int main() {

    
    string x = "hello world";

    
    x = "";

    
    x = "ab\0";
    cout << x << '\n';
    cout << x.length() << '\n';

    
    if (x == "hello") {
        cout << "equal\n";
    } else {
        cout << "not equal\n";
    }
    if (x < "bc") {
        cout << "x is lexigraphically less than 'bc'\n";
    }

    
    auto y = x;
    cout << boolalpha << (x == y) << '\n';
    cout << boolalpha << (&x == &y) << '\n';

    
    string empty = "";
    if (empty.empty()) {
        cout << "String is empty\n";
    }

    
    x = "helloworld";
    x += (char)83;
    cout << x << '\n';

    
    auto slice = x.substr(5, 5);
    cout << slice << '\n';

    
    auto greeting = replaceFirst(x, "worldS", "");
    cout << greeting << '\n';

    
    auto join = greeting + ' ' + slice;
    cout << join << '\n';

    return 0;
}










Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings




Go: package main

import (
    "bytes"
    "fmt"
)








func main() {
    
    
    
    b := []byte{'b', 'i', 'n', 'a', 'r', 'y'}
    fmt.Println(b) 
    

    
    
    
    
    var c []byte
    c = b
    fmt.Println(c)

    
    
    
    
    
    fmt.Println(bytes.Equal(b, c)) 

    
    
    
    
    
    
    d := make([]byte, len(b)) 
    copy(d, b)                
    
    d[1] = 'a'
    d[4] = 'n'
    fmt.Println(string(b)) 
    fmt.Println(string(d))

    
    
    
    fmt.Println(len(b) == 0)

    
    
    
    
    
    z := append(b, 'z')
    fmt.Printf("%s\n", z) 

    
    
    sub := b[1:3]
    fmt.Println(string(sub))

    
    
    
    
    
    
    f := bytes.Replace(d, []byte{'n'}, []byte{'m'}, -1)
    fmt.Printf("%s -> %s\n", d, f)

    
    
    
    
    rem := append(append([]byte{}, b[:1]...), b[3:]...)
    fmt.Println(string(rem))
}








Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings







Python: s1 = "A 'string' literal \n"
s2 = 'You may use any of \' or " as delimiter'
s3 = 





Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings








VB: 
Option Compare Binary 

Option Compare Text 




Ada: declare
   Data : Storage_Array (1..20); 
begin
   Data := (others => 0); 
   if Data = (1..10 => 0) then 
      declare
         Copy : Storage_Array := Data; 
      begin
         if Data'Length = 0 then 
            ...
         end if;
      end;
   end if;
   ... Data & 1 ...         
   ... Data & (1,2,3,4) ... 
   ... Data (3..5) ...      
end;
Task: Binary strings

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct str_t {
	size_t len, alloc;
	unsigned char *s;
} bstr_t, *bstr;

#define str_len(s) ((s)->len)
bstr str_new(size_t len)
{
	bstr s = malloc(sizeof(bstr_t));
	if (len < 8) len = 8;
	s->alloc = len;
	s->s = malloc(len);
	s->len = 0;
	return s;
}

void str_extend(bstr s)
{
	size_t ns = s->alloc * 2;
	if (ns - s->alloc > 1024) ns = s->alloc + 1024;
	s->s = realloc(s->s, ns);
	s->alloc = ns;
}

void str_del(bstr s)
{
	free(s->s), free(s);
}

int str_cmp(bstr l, bstr r)
{
	int res, len = l->len;
	if (len > r->len) len = r->len;

	if ((res = memcmp(l->s, r->s, len))) return res;
	return l->len > r->len ? 1 : -1;
}

bstr str_dup(bstr src)
{
	bstr x = str_new(src->len);
	memcpy(x->s, src->s, src->len);
	x->len = src->len;
	return x;
}

bstr str_from_chars(const char *t)
{
	if (!t) return str_new(0);
	size_t l = strlen(t);
	bstr x = str_new(l + 1);
	x->len = l;
	memcpy(x->s, t, l);
	return x;
}

void str_append(bstr s, unsigned char b)
{
	if (s->len >= s->alloc) str_extend(s);
	s->s[s->len++] = b;
}

bstr str_substr(bstr s, int from, int to)
{
	if (!to) to = s->len;
	if (from < 0) from += s->len;
	if (from < 0 || from >= s->len)
		return 0;
	if (to < from) to = from + 1;
	bstr x = str_new(to - from);
	x->len = to - from;
	memcpy(x->s, s->s + from, x->len);
	return x;
}

bstr str_cat(bstr s, bstr s2)
{
	while (s->alloc < s->len + s2->len) str_extend(s);
	memcpy(s->s + s->len, s2->s, s2->len);
	s->len += s2->len;
	return s;
}

void str_swap(bstr a, bstr b)
{
	size_t tz;
	unsigned char *ts;
	tz = a->alloc; a->alloc = b->alloc; b->alloc = tz;
	tz = a->len; a->len = b->len; b->len = tz;
	ts = a->s; a->s = b->s; b->s = ts;
}

bstr str_subst(bstr tgt, bstr pat, bstr repl)
{
	bstr tmp = str_new(0);
	int i;
	for (i = 0; i + pat->len <= tgt->len;) {
		if (memcmp(tgt->s + i, pat->s, pat->len)) {
			str_append(tmp, tgt->s[i]);
			i++;
		} else {
			str_cat(tmp, repl);
			i += pat->len;
			if (!pat->len) str_append(tmp, tgt->s[i++]);
		}
	}
	while (i < tgt->len) str_append(tmp, tgt->s[i++]);
	str_swap(tmp, tgt);
	str_del(tmp);
	return tgt;
}

void str_set(bstr dest, bstr src)
{
	while (dest->len < src->len) str_extend(dest);
	memcpy(dest->s, src->s, src->len);
	dest->len = src->len;
}

int main()
{
	bstr s = str_from_chars("aaaaHaaaaaFaaaaHa");
	bstr s2 = str_from_chars("___.");
	bstr s3 = str_from_chars("");

	str_subst(s, s3, s2);
	printf("%.*s\n", s->len, s->s);

	str_del(s);
	str_del(s2);
	str_del(s3);

	return 0;
}
Task: Binary strings



C#: using System;

class Program
{
    static void Main()
    {
        
        var x = "hello world";

        
        x = null;

        
        x = "ab\0";
        Console.WriteLine(x);
        Console.WriteLine(x.Length); 

        
        if (x == "hello")
            Console.WriteLine("equal");
        else
            Console.WriteLine("not equal");

        if (x.CompareTo("bc") == -1)
            Console.WriteLine("x is lexicographically less than 'bc'");

        
        var c = new char[3];
        x.CopyTo(0, c, 0, 3);
        object objecty = new string(c);
        var y = new string(c);

        Console.WriteLine(x == y);      
        Console.WriteLine(x.Equals(y)); 

        Console.WriteLine(x == objecty); 

        
        var empty = "";
        string nullString = null;
        var whitespace = "   ";
        if (nullString == null && empty == string.Empty && 
            string.IsNullOrEmpty(nullString) && string.IsNullOrEmpty(empty) &&
            string.IsNullOrWhiteSpace(nullString) && string.IsNullOrWhiteSpace(empty) &&
            string.IsNullOrWhiteSpace(whitespace))
            Console.WriteLine("Strings are null, empty or whitespace");

        
        x = "helloworld";
        x += (char)83;
        Console.WriteLine(x);

        
        var slice = x.Substring(5, 5);
        Console.WriteLine(slice);

        
        var greeting = x.Replace("worldS", "");
        Console.WriteLine(greeting);

        
        var join = greeting + " " + slice;
        Console.WriteLine(join);
    }
}
Task: Binary strings


C++: #include <iomanip>
#include <iostream>

using namespace std;

string replaceFirst(string &s, const string &target, const string &replace) {
    auto pos = s.find(target);
    if (pos == string::npos) return s;
    return s.replace(pos, target.length(), replace);
}

int main() {

    
    string x = "hello world";

    
    x = "";

    
    x = "ab\0";
    cout << x << '\n';
    cout << x.length() << '\n';

    
    if (x == "hello") {
        cout << "equal\n";
    } else {
        cout << "not equal\n";
    }
    if (x < "bc") {
        cout << "x is lexigraphically less than 'bc'\n";
    }

    
    auto y = x;
    cout << boolalpha << (x == y) << '\n';
    cout << boolalpha << (&x == &y) << '\n';

    
    string empty = "";
    if (empty.empty()) {
        cout << "String is empty\n";
    }

    
    x = "helloworld";
    x += (char)83;
    cout << x << '\n';

    
    auto slice = x.substr(5, 5);
    cout << slice << '\n';

    
    auto greeting = replaceFirst(x, "worldS", "");
    cout << greeting << '\n';

    
    auto join = greeting + ' ' + slice;
    cout << join << '\n';

    return 0;
}
Task: Binary strings





Java: module BinaryStrings
    {
    @Inject Console console;
    void run()
        {
        Byte[] mutableBytes = new Byte[];       
        Byte[] fixedLength  = new Byte[10];     
        Byte[] literal      = [0, 1, 7, 0xff];  
        console.print($|String creation and assignment:
                       |  mutableBytes={mutableBytes}
                       |  fixedLength={fixedLength}
                       |  literal={literal}
                       |
                     );

        console.print($|Check if a string is empty:
                       |  mutableBytes.empty={mutableBytes.empty}
                       |  fixedLength.empty={fixedLength.empty}
                       |  literal.empty={literal.empty}
                       |
                     );

        mutableBytes += 0;                      
        mutableBytes.add(1);                    
        mutableBytes.addAll(#07FF);             
        console.print($|Append a byte to a string:
                       |  mutableBytes={mutableBytes}
                       |
                     );

        console.print($|String comparison:
                       |  mutableBytes==literal = {mutableBytes==literal}
                       |  fixedLength==literal = {fixedLength==literal}
                       |
                     );

        fixedLength = new Byte[4](i -> literal[i]);     
        val clone = fixedLength.clone();                
        console.print($|String cloning and copying:
                       |  fixedLength={fixedLength}
                       |  clone={clone}
                       |
                     );

        console.print($|Extract a substring from a string:
                       |  mutableBytes[1..2]={mutableBytes[1..2]}
                       |  fixedLength[0..2]={fixedLength[0..2]}
                       |  literal[2..3]={literal[2..3]}
                       |
                     );

        for (Int start = 0; Int index := fixedLength.indexOf(0x01, start); start = index)
            {
            fixedLength[index] = 0x04;
            }
        console.print($|Replace every occurrence of a byte in a string with another string:
                       |  fixedLength={fixedLength}
                       |
                     );

        for (Int start = 0; Int index := mutableBytes.indexOf(#0107, start); start = index)
            {
            mutableBytes.replaceAll(index, #9876);
            }
        console.print($|Replace every occurrence of a string in a string with another string:
                       |  mutableBytes={mutableBytes}
                       |
                     );

        console.print($|Join strings:
                       |  mutableBytes+fixedLength+literal={mutableBytes+fixedLength+literal}
                       |
                     );
        }
    }
Task: Binary strings







Python: s1 = "A 'string' literal \n"
s2 = 'You may use any of \' or " as delimiter'
s3 =
Task: Binary strings








VB: 
Option Compare Binary 

Option Compare Text
Task: Binary strings




Go: package main

import (
    "bytes"
    "fmt"
)








func main() {
    
    
    
    b := []byte{'b', 'i', 'n', 'a', 'r', 'y'}
    fmt.Println(b) 
    

    
    
    
    
    var c []byte
    c = b
    fmt.Println(c)

    
    
    
    
    
    fmt.Println(bytes.Equal(b, c)) 

    
    
    
    
    
    
    d := make([]byte, len(b)) 
    copy(d, b)                
    
    d[1] = 'a'
    d[4] = 'n'
    fmt.Println(string(b)) 
    fmt.Println(string(d))

    
    
    
    fmt.Println(len(b) == 0)

    
    
    
    
    
    z := append(b, 'z')
    fmt.Printf("%s\n", z) 

    
    
    sub := b[1:3]
    fmt.Println(string(sub))

    
    
    
    
    
    
    f := bytes.Replace(d, []byte{'n'}, []byte{'m'}, -1)
    fmt.Printf("%s -> %s\n", d, f)

    
    
    
    
    rem := append(append([]byte{}, b[:1]...), b[3:]...)
    fmt.Println(string(rem))
}