用(第一个字母+最后一个字母之间的字符数)替换字符串中的每个单词

时间:2015-10-01 08:37:16

标签: objective-c string parsing append

我正在使用objective-c来解析句子:

NSString *myString = @“Some words to form a string”;    

这是我到目前为止所做的:

NSMutableString *firstCharacters = [NSMutableString string];
NSMutableString *lastCharacters = [myString substringFromIndex:[myString length] - 1]

NSArray *arrayOfWords = [myString componentsSeparatedByString:[NSCharacterSet whitespaceCharacterSet]];
for (NSString *word in arrayOfWords) {
    if ([word length] > 0) {
        NSString *firstLetter = [word substringToIndex:1];
        [firstCharacters appendString:lastCharacters];

然后我真的很难过。我想NSLog重组字符串,使它看起来像这样: “S2e w3s to f2m a s3g”

1 个答案:

答案 0 :(得分:1)

请尝试以下代码:

<h:outputLink value="#{request.contextPath}/download/#{bean.fileName}">
    <f:param name="selectedDownloadValue" value="foo" />
    Download
</h:outputLink>