objective c - How to prevent xcode treating <# #> as a code snippet placeholder -
i want include <# #> in literal string in objective c program. however, xcode automatically replaces string thinking should placeholder used in code snippets.
e.g.
nsstring *pattern = @"<#foo#>" try putting xcode , redisplays placeholder foo.
in actual program string re <#(.*)#> , surprisingly, code works intended - problem manifests in display in xcode. real problem creates fragile situation, far easy cause text replaced accidentally when in editor.
as workaround can construct string it's parts
nsstring *p1 = @"<#(.*)"; nsstring *p2 = @"#>"; nsstring *pattern = [nsstring stringwithformat:@"%@%@",p1,p2]; but not satisfactory.
does know better way override behaviour in xcode?
you can avoid bad behavior taking advantage of string concatenation, e.g.
nsstring *str = @"<" "#foo#" ">";
Comments
Post a Comment