Alert換行,根據特殊字元換行

2021-08-08 14:16:06 字數 678 閱讀 2906

在alert提示框中,需要根據分號換行,先看一種複雜的方法

nsstring* str=@"123;456;789";

nsarray *arry=[str componentsseparatedbystring:@";"];

nsstring *str2=[[nsstring alloc]init];

for (nsstring *mystr in arry)

nslog(@"%@",str2);

再看一種簡單的方法

tips = [tips stringbyreplacingoccurrencesofstring:@";" withstring:@"\n"];

uialertcontroller *alert = [uialertcontroller alertcontrollerwithtitle:@"更新提示!"

message:tips preferredstyle:uialertcontrollerstylealert];

放到alertcontroller中左對齊,效果如下

alerter中左對齊效果,參考具體微博:

C 字元換行

在c c 語言中,可能我們要書寫的乙個字串太長了,放在一行上影響 的可讀性。這時我們就需要多行書寫了。字串多行書寫有兩種規則 在字串換行處加乙個反斜槓 下一行前不能有空格或者tab鍵 使用雙引號。程式示例 introduction 測試c 中的字串多行書寫規則 include include usi...

C 字元換行

在c c 語言中,可能我們要書寫的乙個字串太長了,放在一行上影響 的可讀性。這時我們就需要多行書寫了。字串多行書寫有兩種規則 在字串換行處加乙個反斜槓 下一行前不能有空格或者tab鍵 使用雙引號。程式示例 introduction 測試c 中的字串多行書寫規則 include include usi...

html span標籤 不換行 字元換行問題

html span標籤 不換行 有時span帶中文時候是可以自動換行的 加上樣式 style display inline block width 60 word wrap break word white space normal 是因為 span 不是塊狀元素。本身自帶有 左浮動的效果,並且連續...