Convert a value to a string, if possible.
963495
def toString(value):
        
        if isinstance(value, basestring):
            return value
        elif type(value) in [np.string_, np.str_]:
            return str(value)
        elif type(value) == np.unicode_:
            return unicode(value)
        else:
            raise TypeError("Could not convert %s to string type" % type(value))
622948
def from_str(value):
    '''
    
    '''
    if value == 'none':
        value = None
    if value:
        value = str(value)
        if value.startswith('"') and value.endswith('"'):
            value = value[1:-1]
        value = value.replace('\\"', '"')

    return value
1024147
def _Encode(self, value):
    """"""
    try:
      return value.SerializeToString().encode("hex")
    except AttributeError:
      if isinstance(value, (int, long)):
        return str(value).encode("hex")
      else:
        # Types "string" and "bytes" are stored as strings here.
        return utils.SmartStr(value).encode("hex")
1099252
def _send_string(self,value):
        

        if type(value) != bytes:
            value = "{}".format(value).encode("ascii")

        return value
340109
def __toString(self, values):
		
		for key in values:
			if not values[key] is str:
				values[key] = str(values[key])
		return values
712913
def format_value(self, val):
        """"""
        if isinstance(val, six.text_type):
            return self.format_string(val)
        else:
            return six.text_type(val)
179755
def to_text(value):
    

    text = _by_value.get(value)
    if text is None:
        text = str(value)
    return text
1192617
def _tostring(value):
        ''''''
        if value is True:
            value = 'true'
        elif value is False:
            value = 'false'
        elif value is None:
            value = ''
        return unicode(value)
412876
public static String valueToString(Object value) {
		if (value == null) {
			return "null";
		} else if (!value.getClass().isArray()) {
			return value.toString();
		}

		StringBuilder sb = new StringBuilder();
		valueToString(sb, value);
		return sb.toString();
	}
563894
function getStringValue(value)
{
	var return_value = '';
	switch(typeof(value))
	{
		case 'string':
			return_value = "'" + value + "'";
			break;

		case 'number':
			return_value = value;
			break;

		case 'object':

			if(value==null)
					return_value = value;
			else
			{
					var valuestring = JSON.stringify(value);
					return_value = "'" + valuestring + "'";
			}
			break;

		default:
			return_value = "'" + value + "'";
			break;
	}
  return return_value;
}
400418
private function as_string( $value ) {

		if ( is_object( $value ) && method_exists( $value, '__toString' ) ) {
			$value = (string) $value;
		}

		if ( is_string( $value ) ) {
			return $value;
		} elseif ( is_null( $value ) ) {
			return 'NULL';
		} elseif ( is_bool( $value ) ) {
			return $value ? '(boolean) TRUE' : '(boolean) FALSE';
		}

		if ( is_object( $value ) ) {
			$value = get_class( $value );
			$type  = '(object) ';
		} elseif ( is_array( $value ) ) {
			$type  = '';
			$value = var_export( $value, TRUE );
		}

		isset( $type ) or $type = '(' . gettype( $value ) . ') ';

		return $type . (string) $value;
	}
1183047
def format_value(self, value, padding):
        """"""

        # padding = padding - 1 if value < 0 and padding > 0 else padding
        # prefix = '-' if value < 0 else ''

        if padding:
            return "{:0{pad}d}".format(value, pad=padding)

        else:
            return str(value)
27104
def _to_str(self, value, field_begin, field_len):
        
        value_str = '{0:0{1}d}'.format(value, field_len)
        if self.precision is not None and \
                self.precision < field_begin + field_len:
            # field is partly or completely affected by precision
            # -> replace insignificant digits with asterisks
            precision_index = max(0, self.precision - field_begin)
            value_str = value_str[:precision_index] + \
                '*' * (field_len - precision_index)
        return value_str
1162085
def to_str(self):
        """"""
        val = c_backend.pystring_get_str(self._ptr)
        delattr(self, '_ptr')
        setattr(self, 'to_str', _dangling_pointer)
        return val.decode("utf-8")
30995
def stringify(self, value, **opts):
        
        if self._is_null(value):
            return None
        try:
            opts_ = self.opts.copy()
            opts_.update(opts)
            return self._stringify(value, **opts_)
        except Exception as e:
            if not isinstance(e, ConverterError):
                e = ConverterError(None, exc=e)
            e.converter = self.__class__
            raise e
671216
public static String toStr(Object value, String defaultValue) {
		return convert(String.class, value, defaultValue);
	}
895344
def make_str(value):
    """"""
    if isinstance(value, bytes):
        try:
            return value.decode(sys.getfilesystemencoding())
        except UnicodeError:
            return value.decode('utf-8', 'replace')
    return text_type(value)