字符串固定宽度自动换行,之前一直做是没有问题的,可能是这次的字体有些特殊。导致固定宽度下每行的字符个数不一致。

所以每两个字符之间添加换行符

    //去除,
NSString *name = [themeModel.theme_name stringByReplacingOccurrencesOfString:@"," withString:@""];
NSMutableString *title = [name mutableCopy];
for (NSInteger i = title.length -2 ; i >= 2 ; i -= 2) {
[title insertString:@"\n" atIndex:i];
if (i <= 2) {
self.titleLB.text =title;
[self setUI];
}
}

iOS字符串固定间隔换行的更多相关文章

  1. delphi字符串固定长度换行

    var   str,capstr:string;   i,j:integer;   .................... j:=500;   //这个地方可能要根据你显示的宽度来换算对应的字符长度 ...

  2. iOS 字符串处理笔记

    iOS字符串处理笔记,包括如何使用正则表达式解析,NSScanner扫描,设置和使用CoreParse解析器来解析处理自定义符号等内容 搜索 在一个字符串中搜索子字符串 最灵活的方法 - (NSRan ...

  3. NSString -- UILabel中字体有多种颜色,字符串自动计算高度/换行

    一:UILabel中字体有多种颜色 UILabel *label = [[UILabel alloc] init]; label.frame = CGRectMake(, , , ); label.b ...

  4. iOS字符串加密至MD5&及获取文件MD5

    iOS 字符串加密至MD5 #import <CommonCrypto/CommonDigest.h> + (NSString *) md5:(NSString *)str { const ...

  5. iOS 字符串 MD5

    iOS 字符串 MD5 Objective-C 实现 需要引入头文件 #import <CommonCrypto/CommonCrypto.h> 这里用方法实现 + (nullable N ...

  6. Java 去掉字符串中的换行符回车符等

    去掉一个字符串中的换行符.回车符等,将连续多个空格替换成一个空格 String string = "this just a test" Pattern p = Pattern.co ...

  7. iOS字符串安全

    iOS字符串安全 一个编译成功的可执行程序,其中已初始化的字符串都是完整可见的. 针对于iOS的Mach-O二进制通常可获得以下几种字符串信息: 资源文件名 可见的函数符号名 SQL语句 format ...

  8. nl2br()处理字符串中的换行符

    nl2br() 函数 在字符串中包含换行符时,需要对其进行转换,php 中有str_replace()函数,可以直接对字符串进行替换处理.但php中还有nl2br()函数可以直接处理. 1.在字符串中 ...

  9. 将string字符串中的换行符进行替换

    /** * 方法名称:replaceBlank * 方法描述: 将string字符串中的换行符进行替换为"" * */ public static String replaceBl ...

随机推荐

  1. emacs-w3m查看html帮助手册

    emacs-w3m查看html帮助手册 */--> code {color: #FF0000} pre.src {background-color: #002b36; color: #83949 ...

  2. 20-python基础-python3-reversed()函数

    描述 reversed 函数返回一个反转的迭代器. 语法 reversed(seq) 参数 seq -- 要转换的序列,可以是 tuple, string, list 或 range. # 字符串 s ...

  3. Spring Boot 中 @SpringBootApplication注解背后的三体结构探秘

    概 述 SpringBoot 约定大于配置 的功力让我们如沐春风,在我之前写的文章<从SpringBoot到SpringMVC> 也对比过 SpringBoot 和 SpringMVC 这 ...

  4. stty - 改变并打印终端行设置

    总览 stty [-F device] [--file=device] [SETTING]... stty [-F device] [--file=device] [-a|--all] stty [- ...

  5. Mysql差集

    记录一个去差集的SQL 今天用sql去同步部分历史数据,需要用到一个求差集的sql 两张表简单结构如下: 有一个会员表 一个会员账户表 获取没有账户的会员 SELECT m.pkMember FROM ...

  6. codeforces 1182E Product Oriented Recurrence 矩阵快速幂

    题意:设f(n) = c ^ (2n - 6) * f(n - 1) * f(n - 2) * f(n - 3), 问第n项是多少? 思路:官方题解:我们先转化一下,令g(x) =  c ^ x * ...

  7. 初撩Django-RESTful-rest_framework视图函数

    rest_framework中的视图函数: View函数 APIView函数 APIView的子类 mixins函数 viewsets函数 1.View函数 2.APIView函数 3.APIView ...

  8. 解决Zookeeper报错:conf is not executed because it is not in the whitelist的解决办法

    1.echo wchp | nc localhost 2181 ,通过路径列出服务器 watch 的详细信息,且它会输出一个与 session 相关的路径.但是出现下面的错误. [root@xg61 ...

  9. CSIC_716_20191216【pymysql模块】

    强调:mysql要设置严格模式,在my.ini 配置文件中 sql-mode="strict_trans_tables,only_full_group_by"    ,设置完要重启 ...

  10. Centos7.2安装MariaDB数据库,并进行基础配置

    [注] MariaDB的安装与配置感谢博主carlo-jie的分享,原博文地址https://www.cnblogs.com/carlo-jie/p/6104135.html. 第二小节:用户创建及权 ...