#import "string.h"const int COUNTS_OF_liNE = 93;voID cpytoend(char* str,char* pstart,char* pend){ while (pstart != pend + 1) { *str = *pstart == '\n'? ' ': *pstart;//对换行符进行特殊处理 pstart++; str++; } *str = '';}BOol isEnd(char c){ if (c == ' ' || c == ',' || c == '.')//可作为换行的标识字符 { return YES; } else { return NO; }}int main (int argc,const char * argv[]) { NSautoreleasePool * pool = [[NSautoreleasePool alloc] init]; char strContent[2048] = {0}; Nsstring * astring = The Remote Controller is an application that turns your iPad," "iPhone or iPad touch into a remote control for your IPTV. \n" "jk's vision is to enrich people's lives through communication. By Leveraging our experIEnce and" "expertise in telecom sector,we help brIDge the digtal " "digital divIDe and give people the opportunity to join the information age,regardless og their geographic origin. In order to tackle increasing climate " "challenges,jk has deployed a wIDe range of green solutions that enable customers to reduce power consumption and carbon emissions,contributing to the " "sustainable develoopment of the social economy and the environment."; strcpy(strContent,[astring UTF8String]); char * pchstart = strContent; char * pend = pchstart; int number = 0; while (*pend != '') { if (number < COUNTS_OF_liNE) { if ( *pend == '\n' || *(pend + 1) == '') { char tmpstr[100] = {0}; cpytoend(tmpstr,pchstart,pend); NSLog(@"======%s",tmpstr); pchstart = pend + 1; number = 0; } } else { if (isEnd(*pend) ) { char tmpstr[100] = {0}; cpytoend(tmpstr,tmpstr); pchstart = pend + 1; number = 0; } } number++; pend++; }}总结
以上是内存溢出为你收集整理的自动换行模糊处理全部内容,希望文章能够帮你解决自动换行模糊处理所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)