Set the constant value for this field as a string.
162851
public void setConstantValue(String value) {
        addAttribute(new ConstantValueAttr
                     (mCp, ConstantStringInfo.make(mCp, value)));
    }
1305846
public void setString(@NotNull final String key, @NotNull final String value) {
        props.setProperty(key, value);
        LOGGER.debug("Setting: {}='{}'", key, value);
    }
1299964
def set_field(obj, field_name, value):
    """"""
    old = getattr(obj, field_name)
    field = obj._meta.get_field(field_name)
    # is_relation is Django 1.8 only
    if field.is_relation:
        # If field_name is the `_id` field, then there is no 'pk' attr and
        # old/value *is* the pk
        old_repr = None if old is None else getattr(old, 'pk', old)
        new_repr = None if value is None else getattr(value, 'pk', value)
    elif field.__class__.__name__ == 'DateTimeField':
        old_repr = None if old is None else datetime_repr(old)
        new_repr = None if value is None else datetime_repr(value)
    else:
        old_repr = None if old is None else str(old)
        new_repr = None if value is None else str(value)
    if old_repr != new_repr:
        setattr(obj, field_name, value)
        if not hasattr(obj, DIRTY):
            setattr(obj, DIRTY, [])
        getattr(obj, DIRTY).append(dict(
            field_name=field_name,
            old_value=old_repr,
            new_value=new_repr,
        ))
422753
public int setString(String strField, boolean bDisplayOption, int iMoveMode)
    {
        int fieldLength = 0;
        Object tempBinary = null;
        if (strField != null)
        {
            fieldLength = strField.length();
            int maxLength = this.getMaxLength();
            if ((fieldLength > maxLength) || (fieldLength > 40))
                fieldLength = maxLength;
            Date dateOld = new Date((long)this.getValue());  // Save current time
            try   {
                tempBinary = DateConverter.stringToBinary(strField, dateOld, m_sDateFormat);
            } catch (Exception ex)  {
                String strError = ex.getMessage();
                if (strError == null)
                    strError = ex.getClass().getName();
                Task task = null;
                if (this.getField() != null)
                    if (((BaseField)this.getField()).getRecord() != null)
                        if (((BaseField)this.getField()).getRecord().getRecordOwner() != null)
                            task = ((BaseField)this.getField()).getRecord().getRecordOwner().getTask();
                //if (task == null)
                //    task = BaseApplet.getSharedInstance();
                return task.setLastError(strError);
            }
        }
        return this.setData(tempBinary, bDisplayOption, iMoveMode);
    }
470156
def _SetField(self, args, type_info, value):
    """"""
    if hasattr(type_info, "enum"):
      try:
        coerced_obj = type_info.enum[value.upper()]
      except KeyError:
        # A bool is an enum but serializes to "1" / "0" which are both not in
        # enum or reverse_enum.
        coerced_obj = type_info.type.FromHumanReadable(value)
    else:
      coerced_obj = type_info.type.FromHumanReadable(value)
    args.Set(type_info.name, coerced_obj)
752235
public void setFormValueAsString(String value) {

        if (!CmsStringUtil.isEmpty(value)) {
            try {
                long time = Long.parseLong(value);
                setValue(new Date(time));
            } catch (NumberFormatException e) {
                // if the String value is none long number make the field empty
                setValue(null);
            }
        } else {
            // if the value is <code>null</code> make the field empty
            setValue(null);
        }
    }
3036
static String constantValueExpression(Object cb) {
        if (cb == null) return null;
        if (cb instanceof Character) return sourceForm(((Character)cb).charValue());
        if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue());
        if (cb instanceof String) return sourceForm((String)cb);
        if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd');
        if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f');
        if (cb instanceof Long) return cb + "L";
        return cb.toString(); // covers int, short
    }
1046546
def to_str(value):
    '''
    
    '''
    value = from_str(value)

    if value:
        value = value.replace('"', '\\"')
        if ' ' in value:
            value = '"' + value + '"'
    elif value is None:
        value = 'none'

    return value
566718
def set(self, name, value):
        """"""
        name = self._convert_name(name)

        if ((name in _ELEMENTSFIELD or name == 'Platform') and
            not isinstance(value, (list, tuple))):
            if isinstance(value, string_types):
                value = [v.strip() for v in value.split(',')]
            else:
                value = []
        elif (name in _LISTFIELDS and
              not isinstance(value, (list, tuple))):
            if isinstance(value, string_types):
                value = [value]
            else:
                value = []

        if logger.isEnabledFor(logging.WARNING):
            project_name = self['Name']

            scheme = get_scheme(self.scheme)
            if name in _PREDICATE_FIELDS and value is not None:
                for v in value:
                    # check that the values are valid
                    if not scheme.is_valid_matcher(v.split(';')[0]):
                        logger.warning(
                            "'%s': '%s' is not valid (field '%s')",
                            project_name, v, name)
            # FIXME this rejects UNKNOWN, is that right?
            elif name in _VERSIONS_FIELDS and value is not None:
                if not scheme.is_valid_constraint_list(value):
                    logger.warning("'%s': '%s' is not a valid version (field '%s')",
                                   project_name, value, name)
            elif name in _VERSION_FIELDS and value is not None:
                if not scheme.is_valid_version(value):
                    logger.warning("'%s': '%s' is not a valid version (field '%s')",
                                   project_name, value, name)

        if name in _UNICODEFIELDS:
            if name == 'Description':
                value = self._remove_line_prefix(value)

        self._fields[name] = value
17205
public static void setValue(Field field, Object self, Object value) {
        try {
            field.set(self, value);
        } catch (IllegalAccessException e) {
            throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_SET_FIELD)
                    .put("field", field.toGenericString());
        }
    }
1011713
def set(self, value):
        

        if not isinstance(value, str_cls):
            raise TypeError(unwrap(
                '''
                %s value must be a unicode string, not %s
                ''',
                type_name(self),
                type_name(value)
            ))

        if value.startswith('.'):
            encoded_value = b'.' + value[1:].encode(self._encoding)
        else:
            encoded_value = value.encode(self._encoding)

        self._unicode = value
        self.contents = encoded_value
        self._header = None
        if self._trailer != b'':
            self._trailer = b''
981840
public void setValue(String field, byte[] value) throws IOException {
        int hash = Arrays.hashCode(field.getBytes());
        if (!structure.valueHash2Index.containsKey(hash)) {
            throw new IOException("The field " + field + " is unknown.");
        }
        setValue(structure.valueHash2Index.get(hash), value);
    }
791526
@PublicEvolving
	public void setString(ConfigOption<String> key, String value) {
		setValueInternal(key.key(), value);
	}
1236303
def set_string(self, option, value):
        
        if not isinstance(value, str):
            raise TypeError("%s must be a string" % option)

        self.options[option] = value
630845
def _to_string(val):
    """"""
    if isinstance(val, binary_type):
        return val.decode('utf-8')
    assert isinstance(val, text_type)
    return val
136629
@NonNull
    @Override
    public MutableDocument setString(@NonNull String key, String value) {
        return setValue(key, value);
    }
1008373
def set(constants):
    
    if not constants:
        return
    constants = wrap(constants)

    for k, new_value in constants.leaves():
        errors = []
        try:
            old_value = mo_dots_set_attr(sys.modules, k, new_value)
            continue
        except Exception as e:
            errors.append(e)

        # ONE MODULE IS MISSING, THE CALLING MODULE
        try:
            caller_globals = sys._getframe(1).f_globals
            caller_file = caller_globals["__file__"]
            if not caller_file.endswith(".py"):
                raise Exception("do not know how to handle non-python caller")
            caller_module = caller_file[:-3].replace("/", ".")

            path = split_field(k)
            for i, p in enumerate(path):
                if i == 0:
                    continue
                prefix = join_field(path[:1])
                name = join_field(path[i:])
                if caller_module.endswith(prefix):
                    old_value = mo_dots_set_attr(caller_globals, name, new_value)
                    if DEBUG:
                        from mo_logs import Log

                        Log.note(
                            "Changed {{module}}[{{attribute}}] from {{old_value}} to {{new_value}}",
                            module=prefix,
                            attribute=name,
                            old_value=old_value,
                            new_value=new_value
                        )
                    break
        except Exception as e:
            errors.append(e)

        if errors:
            from mo_logs import Log

            Log.error("Can not set constant {{path}}", path=k, cause=errors)