我已经实现了一个应该生成的ruby脚本&将默认代码段插入到正确的位置。问题是这些代码段中的一些必须遵守已有代码的字母顺序。正则表达式按字母顺序将一个单词插入文本
作为一个例子,假设我们需要为字“拇指”一个码片(在这种情况下,将UPDATEFIELD((&(thumb)), ([custominputstream readString]));
)插入到下面的代码:
//...
UPDATEFIELD((&(answers)), ((ListTO *)[custominputstream readCustomSerializable]));
UPDATEFIELD((&(text)), ([custominputstream readString]));
UPDATEFIELD((&(title)), ([custominputstream readString]));
//...
的希望的结果是:
//...
UPDATEFIELD((&(answers)), ((ListTO *)[custominputstream readCustomSerializable]));
UPDATEFIELD((&(text)), ([custominputstream readString]));
UPDATEFIELD((&(thumb)), ([custominputstream readString])); //here is the right place to do it.
UPDATEFIELD((&(title)), ([custominputstream readString]));
//...
问题是如何找到这个文本插入正确的地方用正则表达式/是否有可能呢?
告诉我们你已经尝试过什么。 – mudasobwa
@mudasobwa我还没有在文档中发现任何与我的问题相关的内容,所以没有任何内容可以显示。 – nrx
编程不是关于docs/SO的复制粘贴解决方案,而是解决问题。 – mudasobwa