gpt4 book ai didi

ios - 将 NSString 转换为其他 NSString

转载 作者:行者123 更新时间:2023-11-28 21:48:20 25 4
gpt4 key购买 nike

我有 3 个 NSString 和 1 个带值的 NSArray,我尝试将所有字符串转换为一个:

string01 = [string01 stringByAppendingString:[numbersValue objectAtIndex:Value1 -1]];
string03 = [string02 stringByAppendingString:[numbersValue objectAtIndex:Value2 -1]];
string03 = [string03 stringByAppendingString:[numbersValue objectAtIndex:Value3 -1]];

//here i will to convert value of striing01 in to string02 and string02 in to string03 than take last string in my UITextView

resulteString = [resulteString stringByAppendingString:<what i can write here?>];

[myTextView setText:resulteString];

就像一台谜机,例如,如果你想到键盘并按 A,

A pass inside a string01 and become B,
B pass inside a string02 and become C,
C pass inside string03 and become D
in my text view i need to see only D

最佳答案

如果 resulteString 是 NSString 类的对象然后使用

resultString = [NSString stringWithFormat:@"%@%@%@%@", resultString,string01, string02, string03];

否则如果 resulteString 是 NSMutableString 类的对象

   resulteString = [resulteString stringByAppendingFormat:@"%@%@%@", string01, string02, string03];

可能对你有帮助。

关于ios - 将 NSString 转换为其他 NSString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29234587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com