【问题标题】:Separate part of string from whole string [duplicate]将字符串的一部分与整个字符串分开[重复]
【发布时间】:2012-06-20 05:47:11
【问题描述】:

可能重复:
Objective C: How to extract part of a String (e.g. start with '#')

我想把字符串分成几部分。我的字符串是:

NSString * myString = @"Multiply top and bottom to get < mathtype x3y2z3 over x3yz2 >,now cancel down the powers of < i >x, y, z< /i >.If you prefer, you can cancel down before you start multiplying.";

我需要这三个部分。 1.上下相乘得到 2. 3.,现在取消x,y,z的幂。如果你愿意,你可以在开始乘法之前取消。

我该怎么做?

【问题讨论】:

    标签: iphone string ipad nsstring


    【解决方案1】:

    如果上述方法失败,您始终可以将其转换为字符数组并循环遍历它。

    - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding
    

    NSString Docs有更多详情

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-22
      • 1970-01-01
      相关资源
      最近更新 更多