// ConcatString recursively concatenates strings from a binary expression
5964
func ConcatString(n *ast.BinaryExpr) (string, bool) {
	var s string
	// sub expressions are found in X object, Y object is always last BasicLit
	if rightOperand, ok := n.Y.(*ast.BasicLit); ok {
		if str, err := GetString(rightOperand); err == nil {
			s = str + s
		}
	} else {
		return "", false
	}
	if leftOperand, ok := n.X.(*ast.BinaryExpr); ok {
		if recursion, ok := ConcatString(leftOperand); ok {
			s = recursion + s
		}
	} else if leftOperand, ok := n.X.(*ast.BasicLit); ok {
		if str, err := GetString(leftOperand); err == nil {
			s = str + s
		}
	} else {
		return "", false
	}
	return s, true
}
982092
func (s Set) Concat(ctx context.Context, a, b string) (string, error) {
	resp, err := s.ConcatEndpoint(ctx, ConcatRequest{A: a, B: b})
	if err != nil {
		return "", err
	}
	response := resp.(ConcatResponse)
	return response.V, response.Err
}
102389
func StringToConstant(s string) string {
	newParts := []string{}
	parts := strings.Split(s, "_")
	ciMap := CommonInitialismsMap()
	for _, p := range parts {
		pUp := strings.ToUpper(p)
		if _, ok := ciMap[pUp]; ok {
			newParts = append(newParts, pUp)
		} else {
			newParts = append(newParts, ToUpperFirst(strings.ToLower(p)))
		}
	}
	return strings.Join(newParts, "")
}
337702
func ConcatSlash(strs ...string) string {
	out := bytes.Buffer{}
	for _, s := range strs {
		if strings.HasSuffix(s, "/") {
			out.WriteString(s)
		} else {
			out.WriteString(s)
			out.WriteByte('/')
		}
	}

	return string(out.Bytes())
}
1197954
func (enc *Encoder) EncodeString(s string) error {
	if enc.isPooled == 1 {
		panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder"))
	}
	_, _ = enc.encodeString(s)
	_, err := enc.Write()
	if err != nil {
		enc.err = err
		return err
	}
	return nil
}
348638
func (f *formatter) formatString(b []byte, s string) {
	if len(s) > len(b) {
		f.err = ErrFieldTooLong
		return
	}
	ascii := toASCII(s)
	copy(b, ascii)
	if len(ascii) < len(b) {
		b[len(ascii)] = 0
	}
}
82569
func EncodeString(data string) string {
	return strings.Join([]string{strconv.Itoa(len(data)), data}, ":")
}
924916
func (enc *Encoding) EncodeToString(b []byte) string {
	n := new(big.Int)
	r := new(big.Int)
	n.SetBytes(b)
	var result []byte
	for n.Cmp(zero) > 0 {
		n, r = n.DivMod(n, enc.base, r)
		result = append([]byte{enc.alphabet[r.Int64()]}, result...)
	}
	return string(result)
}
784151
func (c *client) concatenate(key1, key2, key3 string, uploadID *string) (*string, *string, error) {
	// The first part to be uploaded which is represented as part number 1
	foo, err := c.s3Client.UploadPartCopy(&s3.UploadPartCopyInput{
		Bucket:     c.bucket,
		CopySource: aws.String(url.QueryEscape(*c.bucket + "/" + key1)),
		PartNumber: aws.Int64(1),
		Key:        &key3,
		UploadId:   uploadID,
	})
	if err != nil {
		return nil, nil, err
	}

	// The second part that is going to be appended to the newly created testKey
	// object.
	bar, err := c.s3Client.UploadPartCopy(&s3.UploadPartCopyInput{
		Bucket:     c.bucket,
		CopySource: aws.String(url.QueryEscape(*c.bucket + "/" + key2)),
		PartNumber: aws.Int64(2),
		Key:        &key3,
		UploadId:   uploadID,
	})
	if err != nil {
		return nil, nil, err
	}
	// The ETags are needed to complete the process
	return foo.CopyPartResult.ETag, bar.CopyPartResult.ETag, nil
}
272572
func DictString(v interface{}, err error) (map[string]interface{}, error) {
	var src map[interface{}]interface{}
	src, err = Dict(v, err)
	if err != nil {
		return nil, err
	}

	return tryDictToDictString(src)
}
1020994
func FlattenString(nestedstr, prefix string, style SeparatorStyle) (string, error) {
	var nested map[string]interface{}
	err := json.Unmarshal([]byte(nestedstr), &nested)
	if err != nil {
		return "", err
	}

	flatmap, err := Flatten(nested, prefix, style)
	if err != nil {
		return "", err
	}

	flatb, err := json.Marshal(&flatmap)
	if err != nil {
		return "", err
	}

	return string(flatb), nil
}
900531
func Concat(slices ...[]interface{}) []interface{} {
	offset := 0
	for _, slice := range slices {
		offset += len(slice)
	}
	concat := make([]interface{}, offset)
	offset = 0
	for _, slice := range slices {
		for i, e := range slice {
			concat[offset+i] = e
		}
		offset += len(slice)
	}
	return concat
}
103300
func Concat(strs ...string) string {
	out := bytes.Buffer{}
	for i, s := range strs {
		if i == 0 {
			out.WriteString(s)
		} else if s != "" {
			out.WriteByte('/')
			out.WriteString(s)
		}
	}
	return string(out.Bytes())
}
591844
func concat(x, y regexpInfo) (out regexpInfo) {
	//println("concat", x.String(), "...", y.String())
	//defer func() { println("->", out.String()) }()
	var xy regexpInfo
	xy.match = x.match.and(y.match)
	if x.exact.have() && y.exact.have() {
		xy.exact = x.exact.cross(y.exact, false)
	} else {
		if x.exact.have() {
			xy.prefix = x.exact.cross(y.prefix, false)
		} else {
			xy.prefix = x.prefix
			if x.canEmpty {
				xy.prefix = xy.prefix.union(y.prefix, false)
			}
		}
		if y.exact.have() {
			xy.suffix = x.suffix.cross(y.exact, true)
		} else {
			xy.suffix = y.suffix
			if y.canEmpty {
				xy.suffix = xy.suffix.union(x.suffix, true)
			}
		}
	}

	// If all the possible strings in the cross product of x.suffix
	// and y.prefix are long enough, then the trigram for one
	// of them must be present and would not necessarily be
	// accounted for in xy.prefix or xy.suffix yet.  Cut things off
	// at maxSet just to keep the sets manageable.
	if !x.exact.have() && !y.exact.have() &&
		x.suffix.size() <= maxSet && y.prefix.size() <= maxSet &&
		x.suffix.minLen()+y.prefix.minLen() >= 3 {
		xy.match = xy.match.andTrigrams(x.suffix.cross(y.prefix, false))
	}

	xy.simplify(false)
	return xy
}
1078659
func (ag *ArgSet) ArgString() string {
	args := make([]string, len(ag.set))
	for i, arg := range ag.set {
		args[i] = arg.ArgString()
	}
	return strings.Join(args, " ")
}
50312
func builtinConcatWS(args []types.Datum, _ context.Context) (d types.Datum, err error) {
	var sep string
	s := make([]string, 0, len(args))
	for i, a := range args {
		if a.IsNull() {
			if i == 0 {
				return d, nil
			}
			continue
		}
		ss, err := a.ToString()
		if err != nil {
			return d, errors.Trace(err)
		}

		if i == 0 {
			sep = ss
			continue
		}
		s = append(s, ss)
	}

	d.SetString(strings.Join(s, sep))
	return d, nil
}
889356
func (a *Arg) ArgString() string {
	return fmt.Sprintf("%v=%v", encoder.Replace(a.key), encoder.Replace(a.val))
}