本文整理汇总了C#中MutableString.RequireNotFrozen方法的典型用法代码示例。如果您正苦于以下问题:C# MutableString.RequireNotFrozen方法的具体用法?C# MutableString.RequireNotFrozen怎么用?C# MutableString.RequireNotFrozen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableString
的用法示例。
在下文中一共展示了MutableString.RequireNotFrozen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpCaseInPlace
public static MutableString UpCaseInPlace(MutableString/*!*/ self) {
self.RequireNotFrozen();
return UpCaseMutableString(self) ? self : null;
}
示例2: TrSqueezeInPlace
public static MutableString TrSqueezeInPlace(MutableString/*!*/ self,
[DefaultProtocol, NotNull]MutableString/*!*/ from, [DefaultProtocol, NotNull]MutableString/*!*/ to) {
bool anyCharacterMaps;
self.RequireNotFrozen();
Translate(self, from, to, true, true, out anyCharacterMaps);
return anyCharacterMaps ? self : null;
}
示例3: CapitalizeInPlace
public static MutableString CapitalizeInPlace(MutableString/*!*/ self) {
self.RequireNotFrozen();
return CapitalizeMutableString(self) ? self : null;
}
示例4: SuccInPlace
public static MutableString/*!*/ SuccInPlace(MutableString/*!*/ self) {
self.RequireNotFrozen();
if (self.IsEmpty) {
return self;
}
int index = GetIndexOfRightmostAlphaNumericCharacter(self, self.Length - 1);
if (index == -1) {
IncrementChar(self, self.Length - 1);
} else {
IncrementAlphaNumericChar(self, index);
}
return self;
}
示例5: Reverse
public static MutableString/*!*/ Reverse(MutableString/*!*/ self) {
if (self.Encoding.IsKCoding) {
throw new NotImplementedException("TODO: KCODE");
}
if (self.Length == 0) {
return self;
}
self.RequireNotFrozen();
// TODO: MRI 1.9: allows invalid characters
return self.Reverse();
}
示例6: Reinitialize
public static MutableString/*!*/ Reinitialize(MutableString/*!*/ self) {
self.RequireNotFrozen();
return self;
}
示例7: DeleteInPlace
public static MutableString/*!*/ DeleteInPlace(RubyContext/*!*/ context, MutableString/*!*/ self,
[DefaultProtocol, NotNull, NotNullItems]params MutableString/*!*/[]/*!*/ strs) {
self.RequireNotFrozen();
if (strs.Length == 0) {
throw RubyExceptions.CreateArgumentError("wrong number of arguments");
}
return InternalDeleteInPlace(self, strs);
}
示例8: Replace
public static MutableString/*!*/ Replace(MutableString/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ other) {
// Handle case where objects are the same identity
if (ReferenceEquals(self, other)) {
self.RequireNotFrozen();
return self;
}
self.Clear();
self.Append(other);
return self.TaintBy(other);
}
示例9: Reverse
public static MutableString/*!*/ Reverse(MutableString/*!*/ self) {
self.RequireNotFrozen();
if (self.IsEmpty) {
return self;
}
// TODO: MRI 1.9: allows invalid characters
return self.Reverse();
}
示例10: ReplaceInPlace
private static MutableString ReplaceInPlace(ConversionStorage<MutableString> toS, BinaryOpStorage hashDefault,
RubyScope/*!*/ scope, MutableString/*!*/ self, RubyRegex/*!*/ pattern,
Union<IDictionary<object, object>, MutableString>/*!*/ replacement, bool replaceAll) {
self.RequireNotFrozen();
MutableString builder = replaceAll ?
ReplaceAll(toS, hashDefault, scope, self, replacement, pattern) :
ReplaceFirst(toS, hashDefault, scope, self, replacement, pattern);
// unsuccessful match:
if (builder == null) {
return null;
}
self.Replace(0, self.Length, builder);
return self.TaintBy(builder);
}
示例11: StripInPlace
public static MutableString StripInPlace(MutableString/*!*/ self, bool trimLeft, bool trimRight) {
int left, right;
GetTrimRange(self, trimLeft, trimRight, out left, out right);
int remaining = right - left;
// nothing to trim:
if (remaining == self.Length) {
self.RequireNotFrozen();
return null;
}
if (remaining == 0) {
// all whitespace
self.Clear();
} else {
self.Trim(left, remaining);
}
return self;
}
示例12: BlockReplaceInPlace
private static object BlockReplaceInPlace(ConversionStorage<MutableString>/*!*/ tosConversion,
RubyScope/*!*/ scope, BlockParam/*!*/ block, MutableString/*!*/ self,
RubyRegex/*!*/ pattern, bool replaceAll) {
object blockResult;
self.RequireNotFrozen();
self.TrackChanges();
// prepare replacement in a builder:
MutableString builder;
if (replaceAll ?
BlockReplaceAll(tosConversion, scope, self, block, pattern, out blockResult, out builder) :
BlockReplaceFirst(tosConversion, scope, self, block, pattern, out blockResult, out builder)) {
// block jumped:
return blockResult;
}
// unsuccessful match:
if (builder == null) {
return null;
}
RequireNoVersionChange(self);
// replace content of self with content of the builder:
self.Replace(0, self.Length, builder);
return self.TaintBy(builder);
}
示例13: ChopInPlace
public static MutableString ChopInPlace(MutableString/*!*/ self) {
self.RequireNotFrozen();
return self.IsEmpty ? null : ChopInteral(self);
}
示例14: ChompInPlace
public static MutableString ChompInPlace(MutableString/*!*/ self, [DefaultProtocol]MutableString separator) {
MutableString result = InternalChomp(self, separator);
if (result.Equals(self) || result == null) {
self.RequireNotFrozen();
return null;
}
self.Clear();
self.Append(result);
return self;
}
示例15: EncodeInPlace
public static MutableString EncodeInPlace(
ConversionStorage<IDictionary<object, object>>/*!*/ toHash,
ConversionStorage<MutableString>/*!*/ toStr,
MutableString/*!*/ self,
[Optional]object toEncoding,
[Optional]object fromEncoding,
[DefaultParameterValue(null), DefaultProtocol]IDictionary<object, object> options)
{
Protocols.TryConvertToOptions(toHash, ref options, ref toEncoding, ref fromEncoding);
// encodings:
RubyEncoding to, from;
MutableString toEncodingName = null, fromEncodingName = null;
if (toEncoding == Missing.Value) {
to = toStr.Context.DefaultInternalEncoding;
if (to == null) {
return self;
}
} else {
to = toEncoding as RubyEncoding;
if (to == null) {
toEncodingName = Protocols.CastToString(toStr, toEncoding);
}
}
if (fromEncoding == Missing.Value) {
from = self.Encoding;
} else {
from = fromEncoding as RubyEncoding;
if (from == null) {
fromEncodingName = Protocols.CastToString(toStr, fromEncoding);
}
}
try {
if (fromEncodingName != null) {
from = toStr.Context.GetRubyEncoding(fromEncodingName);
}
if (toEncodingName != null) {
to = toStr.Context.GetRubyEncoding(toEncodingName);
}
} catch (ArgumentException) {
throw new ConverterNotFoundError(RubyExceptions.FormatMessage("code converter not found ({0} to {1})",
(fromEncodingName != null) ? fromEncodingName.ToAsciiString() : from.Name,
(toEncodingName != null) ? toEncodingName.ToAsciiString() : to.Name
));
}
self.RequireNotFrozen();
// options:
// TODO: options
// :invalid => :replace
// :undef => :replace, :replace => ""
// :xml => :text
// :xml => :attr
self.Transcode(from, to);
return self;
}