当前位置: 首页>>代码示例>>C#>>正文


C# MutableString.RequireNotFrozen方法代码示例

本文整理汇总了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;
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:4,代码来源:MutableStringOps.cs

示例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;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:8,代码来源:MutableStringOps.cs

示例3: CapitalizeInPlace

 public static MutableString CapitalizeInPlace(MutableString/*!*/ self) {
     self.RequireNotFrozen();
     return CapitalizeMutableString(self) ? self : null;
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:4,代码来源:MutableStringOps.cs

示例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;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:16,代码来源:MutableStringOps.cs

示例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();
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:13,代码来源:MutableStringOps.cs

示例6: Reinitialize

 public static MutableString/*!*/ Reinitialize(MutableString/*!*/ self) {
     self.RequireNotFrozen();
     return self;
 }
开发者ID:,项目名称:,代码行数:4,代码来源:

示例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);
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:9,代码来源:MutableStringOps.cs

示例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);
        }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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();
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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);
        }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例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;
        }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例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);
        }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例13: ChopInPlace

 public static MutableString ChopInPlace(MutableString/*!*/ self) {
     self.RequireNotFrozen();
     return self.IsEmpty ? null : ChopInteral(self);
 }
开发者ID:,项目名称:,代码行数:4,代码来源:

示例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;
        }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例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;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:61,代码来源:MutableStringOps.cs


注:本文中的MutableString.RequireNotFrozen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。